From 7079032ef4d9db825b158e564434205af497f27f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 28 Feb 2017 14:53:32 +0100 Subject: [PATCH] fix some breaks, add stats for encrypted/decrypted bytes in CADET --- src/cadet/cadet_api_new.c | 11 ++++++----- src/cadet/gnunet-service-cadet-new.c | 8 +++++--- src/cadet/gnunet-service-cadet-new_tunnels.c | 12 ++++++++---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/cadet/cadet_api_new.c b/src/cadet/cadet_api_new.c index a62de0a47..efdb6d8a6 100644 --- a/src/cadet/cadet_api_new.c +++ b/src/cadet/cadet_api_new.c @@ -626,7 +626,6 @@ handle_channel_created (void *cls, struct GNUNET_CADET_LocalChannelDestroyMessage *d_msg; struct GNUNET_MQ_Envelope *env; - GNUNET_break (0); LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channel %X (on port %s, recently closed?)\n", ntohl (ccn.channel_of_client), @@ -682,16 +681,18 @@ handle_channel_destroy (void *cls, struct GNUNET_CADET_Handle *h = cls; struct GNUNET_CADET_Channel *ch; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received channel destroy for channel %X from CADET service\n", - ntohl (msg->ccn.channel_of_client)); ch = find_channel (h, msg->ccn); if (NULL == ch) { - GNUNET_break (0); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Received channel destroy for unknown channel %X from CADET service\n", + ntohl (msg->ccn.channel_of_client)); return; } + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Received channel destroy for channel %X from CADET service\n", + ntohl (msg->ccn.channel_of_client)); destroy_channel (ch); } diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index de85db5b6..02126d57d 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c @@ -760,9 +760,11 @@ handle_local_ack (void *cls, msg->ccn); if (NULL == ch) { - /* Channel does not exist! */ - GNUNET_break (0); - GNUNET_SERVICE_client_drop (c->client); + /* Channel does not exist (anymore) */ + LOG (GNUNET_ERROR_TYPE_WARNING, + "Ignoring local ACK for channel %u from client (channel unknown, other endpoint may have disconnected)\n", + (unsigned int) ntohl (msg->ccn.channel_of_client)); + GNUNET_SERVICE_client_continue (c->client); return; } LOG (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index bf05fae6b..d50860629 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c @@ -3082,10 +3082,6 @@ GCT_handle_encrypted (struct CadetTConnection *ct, break; } - GNUNET_STATISTICS_update (stats, - "# received encrypted", - 1, - GNUNET_NO); decrypted_size = -1; if (CADET_TUNNEL_KEY_OK == t->estate) { @@ -3166,6 +3162,10 @@ GCT_handle_encrypted (struct CadetTConnection *ct, &t->ax); return; } + GNUNET_STATISTICS_update (stats, + "# decrypted bytes", + decrypted_size, + GNUNET_NO); /* The MST will ultimately call #handle_decrypted() on each message. */ t->current_ct = ct; @@ -3217,6 +3217,10 @@ GCT_send (struct CadetTunnel *t, &ax_msg[1], message, payload_size); + GNUNET_STATISTICS_update (stats, + "# encrypted bytes", + payload_size, + GNUNET_NO); ax_msg->ax_header.Ns = htonl (t->ax.Ns++); ax_msg->ax_header.PNs = htonl (t->ax.PNs); /* FIXME: we should do this once, not once per message; -- 2.25.1