better logging, prep for having LOCAL_ACKs
authorChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 22:50:55 +0000 (23:50 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 22:50:55 +0000 (23:50 +0100)
src/cadet/cadet_api.c
src/cadet/gnunet-service-cadet-new.c
src/cadet/gnunet-service-cadet-new_channel.c
src/cadet/gnunet-service-cadet-new_channel.h

index 53a9548106b09a41d1c43bbb4ab41cc9a90e86d0..859a5378bf36854abd41339ff0c8c9dbe852210a 100644 (file)
@@ -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,
index d2c49db154db0a4526cfd76d0f639d3e62d9fb2c..e67e507e3722063fe1675bdb7087b7d27c1ab090 100644 (file)
@@ -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);
 }
 
index ec594066baa49618fe6dd8caa8c8f26d4ec27dab..74aafe5a1780030950a7b67e66447358e6f27eff 100644 (file)
@@ -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);
 }
 
index d1b854570f89c4ea4f39d23c9a46fe5b5cc93e41..41f0bfe9b44e0977af3c8759cd01bc2e20be24ad 100644 (file)
@@ -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