From: Christian Grothoff Date: Mon, 23 Jan 2017 22:50:55 +0000 (+0100) Subject: better logging, prep for having LOCAL_ACKs X-Git-Tag: taler-0.2.1~320 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3bdda27bbeb0b69bd2c5a73022b237ae0342e9c1;p=oweals%2Fgnunet.git better logging, prep for having LOCAL_ACKs --- diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 53a954810..859a5378b 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -1493,7 +1493,6 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) * @param port Hash representing the port number. * @param new_channel Function called when an channel is received. * @param new_channel_cls Closure for @a new_channel. - * * @return Port handle. */ struct GNUNET_CADET_Port * @@ -1606,7 +1605,8 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel) struct GNUNET_CADET_TransmitHandle *th; struct GNUNET_CADET_TransmitHandle *next; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying channel\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Destroying channel\n"); h = channel->cadet; for (th = h->th_head; th != NULL; th = next) { @@ -1623,7 +1623,8 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel) } else { - LOG (GNUNET_ERROR_TYPE_WARNING, "no meta-traffic should be queued\n"); + LOG (GNUNET_ERROR_TYPE_WARNING, + "no meta-traffic should be queued\n"); } GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index d2c49db15..e67e507e3 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c @@ -753,7 +753,8 @@ handle_ack (void *cls, "Got a local ACK from %s for %s\n", GSC_2s(c), GCCH_2s (ch)); - GCCH_handle_local_ack (ch); + GCCH_handle_local_ack (ch, + msg->ccn); GNUNET_SERVICE_client_continue (c->client); } diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index ec594066b..74aafe5a1 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -1020,10 +1020,6 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, GNUNET_assert (GNUNET_NO == ch->is_loopback); payload_size = ntohs (msg->header.size) - sizeof (*msg); - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Receicved %u bytes of application data on %s\n", - (unsigned int) payload_size, - GCCH_2s (ch)); env = GNUNET_MQ_msg_extra (ld, payload_size, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); @@ -1035,6 +1031,11 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, ( (GNUNET_YES == ch->out_of_order) || (msg->mid.mid == ch->mid_recv.mid) ) ) { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Giving %u bytes of payload from %s to client %s\n", + (unsigned int) payload_size, + GCCH_2s (ch), + GSC_2s (ch->owner ? ch->owner : ch->dest)); GSC_send_to_client (ch->owner ? ch->owner : ch->dest, env); ch->mid_recv.mid = htonl (1 + ntohl (ch->mid_recv.mid)); @@ -1044,6 +1045,16 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, { /* FIXME-SECURITY: if the element is WAY too far ahead, drop it (can't buffer too much!) */ + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Queuing %s payload of %u bytes on %s (mid %u, need %u first)\n", + (GNUNET_YES == ch->client_ready) + ? "out-of-order" + : "client-not-ready", + (unsigned int) payload_size, + GCCH_2s (ch), + ntohl (msg->mid.mid), + ntohl (ch->mid_recv.mid)); + com = GNUNET_new (struct CadetOutOfOrderMessage); com->mid = msg->mid; com->env = env; @@ -1438,11 +1449,15 @@ send_client_buffered_data (struct CadetChannel *ch) * Handle ACK from client on local channel. * * @param ch channel to destroy + * @param client_ccn ccn of the client sending the ack */ void -GCCH_handle_local_ack (struct CadetChannel *ch) +GCCH_handle_local_ack (struct CadetChannel *ch, + struct GNUNET_CADET_ClientChannelNumber client_ccn) { ch->client_ready = GNUNET_YES; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Got LOCAL_ACK, client ready to receive more data!\n"); send_client_buffered_data (ch); } diff --git a/src/cadet/gnunet-service-cadet-new_channel.h b/src/cadet/gnunet-service-cadet-new_channel.h index d1b854570..41f0bfe9b 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.h +++ b/src/cadet/gnunet-service-cadet-new_channel.h @@ -237,8 +237,10 @@ GCCH_handle_local_data (struct CadetChannel *ch, * Handle ACK from client on local channel. * * @param ch channel to destroy + * @param client_ccn ccn of the client sending the ack */ void -GCCH_handle_local_ack (struct CadetChannel *ch); +GCCH_handle_local_ack (struct CadetChannel *ch, + struct GNUNET_CADET_ClientChannelNumber client_ccn); #endif