From: Christian Grothoff Date: Mon, 30 Jan 2017 11:27:11 +0000 (+0100) Subject: have tunnel tell channel which connection it used for transmission, so we can track... X-Git-Tag: taler-0.2.1~244 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=48332ff7d4631f9be2a059c2fe150e3be5fb37f6;p=oweals%2Fgnunet.git have tunnel tell channel which connection it used for transmission, so we can track connection performance by observing ACKs on the channel-level --- diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index 8633e7f74..7929d3c4b 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -501,9 +501,12 @@ send_channel_open (void *cls); * create message. Delays for a bit until we retry. * * @param cls our `struct CadetChannel`. + * @param cid identifier of the connection within the tunnel, NULL + * if transmission failed */ static void -channel_open_sent_cb (void *cls) +channel_open_sent_cb (void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) { struct CadetChannel *ch = cls; @@ -755,9 +758,12 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, * ACKs for ACKs ;-). * * @param cls our `struct CadetChannel`. + * @param cid identifier of the connection within the tunnel, NULL + * if transmission failed */ static void -send_ack_cb (void *cls) +send_ack_cb (void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) { struct CadetChannel *ch = cls; @@ -1322,9 +1328,12 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, * wait for ACK (or retransmit). * * @param cls the `struct CadetReliableMessage` that was sent + * @param cid identifier of the connection within the tunnel, NULL + * if transmission failed */ static void -data_sent_cb (void *cls); +data_sent_cb (void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid); /** @@ -1549,9 +1558,12 @@ cmp_crm_by_next_retry (void *cls, * wait for ACK (or retransmit). * * @param cls the `struct CadetReliableMessage` that was sent + * @param cid identifier of the connection within the tunnel, NULL + * if transmission failed */ static void -data_sent_cb (void *cls) +data_sent_cb (void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) { struct CadetReliableMessage *crm = cls; struct CadetChannel *ch = crm->ch; diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c index 688cb1f80..894ffdcb9 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.c +++ b/src/cadet/gnunet-service-cadet-new_connection.c @@ -315,9 +315,12 @@ send_keepalive (void *cls); * schedule the next one. * * @param cls the `struct CadetConnection` to keep alive. + * @param cid identifier of the connection within the tunnel, NULL + * if transmission failed */ static void -keepalive_done (void *cls) +keepalive_done (void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) { struct CadetConnection *cc = cls; diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index 1afd75bb2..5b44553ee 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c @@ -277,7 +277,7 @@ struct CadetTunnelQueueEntry /** * Continuation to call once sent (on the channel layer). */ - GNUNET_SCHEDULER_TaskCallback cont; + GCT_SendContinuation cont; /** * Closure for @c cont. @@ -2006,7 +2006,8 @@ destroy_tunnel (void *cls) while (NULL != (tq = t->tq_head)) { if (NULL != tq->cont) - tq->cont (tq->cont_cls); + tq->cont (tq->cont_cls, + NULL); GCT_send_cancel (tq); } GCP_drop_tunnel (t->destination, @@ -2156,7 +2157,8 @@ try_send_normal_payload (struct CadetTunnel *t, GCC_transmit (ct->cc, tq->env); if (NULL != tq->cont) - tq->cont (tq->cont_cls); + tq->cont (tq->cont_cls, + GCC_get_id (ct->cc)); GNUNET_free (tq); } @@ -3114,7 +3116,7 @@ GCT_handle_encrypted (struct CadetTConnection *ct, struct CadetTunnelQueueEntry * GCT_send (struct CadetTunnel *t, const struct GNUNET_MessageHeader *message, - GNUNET_SCHEDULER_TaskCallback cont, + GCT_SendContinuation cont, void *cont_cls) { struct CadetTunnelQueueEntry *tq; diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.h b/src/cadet/gnunet-service-cadet-new_tunnels.h index f8613d236..a81bc2341 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.h +++ b/src/cadet/gnunet-service-cadet-new_tunnels.h @@ -201,6 +201,19 @@ GCT_send_channel_destroy (struct CadetTunnel *t, struct GNUNET_CADET_ChannelTunnelNumber ctn); +/** + * Function called when a transmission requested using #GCT_send is done. + * + * @param cls closure + * @param ctn identifier of the connection used for transmission, NULL if + * the transmission failed (to be used to match ACKs to the + * respective connection for connection performance evaluation) + */ +typedef void +(*GCT_SendContinuation)(void *cls, + const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid); + + /** * Sends an already built message on a tunnel, encrypting it and * choosing the best connection if not provided. @@ -214,7 +227,7 @@ GCT_send_channel_destroy (struct CadetTunnel *t, struct CadetTunnelQueueEntry * GCT_send (struct CadetTunnel *t, const struct GNUNET_MessageHeader *message, - GNUNET_SCHEDULER_TaskCallback cont, + GCT_SendContinuation cont, void *cont_cls);