fix some breaks, add stats for encrypted/decrypted bytes in CADET
authorChristian Grothoff <christian@grothoff.org>
Tue, 28 Feb 2017 13:53:32 +0000 (14:53 +0100)
committerChristian Grothoff <christian@grothoff.org>
Tue, 28 Feb 2017 13:53:42 +0000 (14:53 +0100)
src/cadet/cadet_api_new.c
src/cadet/gnunet-service-cadet-new.c
src/cadet/gnunet-service-cadet-new_tunnels.c

index a62de0a4755e031723ab783e1a9270bcc3dac473..efdb6d8a68de959672221482c6ab9e09f45b5987 100644 (file)
@@ -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);
 }
 
index de85db5b6f69ce07d98ad14acfc2087597c1a43f..02126d57d31451be85c24dd66e1e76d94c05ac4c 100644 (file)
@@ -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,
index bf05fae6ba77ed67bbe6eb4a85a198bb0712448f..d50860629312b54edd47d843109a8bee3a97927d 100644 (file)
@@ -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;