API documentation, logging
authorChristian Grothoff <christian@grothoff.org>
Sun, 22 Jan 2017 21:50:38 +0000 (22:50 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sun, 22 Jan 2017 21:50:38 +0000 (22:50 +0100)
src/cadet/gnunet-service-cadet-new_channel.c
src/include/gnunet_cadet_service.h

index 08704152b75560155a586d9e540c24700b818625..690b91f28b5b1a2c7f07e5fdd9e7dc6d0b6d60a7 100644 (file)
@@ -430,6 +430,11 @@ channel_open_sent_cb (void *cls)
   GNUNET_assert (NULL != ch->last_control_qe);
   ch->last_control_qe = NULL;
   ch->retry_time = GNUNET_TIME_STD_BACKOFF (ch->retry_time);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Sent CHANNEL_OPEN on %s, retrying in %s\n",
+       GCCH_2s (ch),
+       GNUNET_STRINGS_relative_time_to_string (ch->retry_time,
+                                               GNUNET_YES));
   ch->retry_control_task
     = GNUNET_SCHEDULER_add_delayed (ch->retry_time,
                                     &send_channel_open,
@@ -487,6 +492,9 @@ void
 GCCH_tunnel_up (struct CadetChannel *ch)
 {
   GNUNET_assert (NULL == ch->retry_control_task);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Tunnel up, sending CHANNEL_OPEN on %s now\n",
+       GCCH_2s (ch));
   ch->retry_control_task
     = GNUNET_SCHEDULER_add_now (&send_channel_open,
                                 ch);
@@ -716,6 +724,9 @@ GCCH_handle_duplicate_open (struct CadetChannel *ch)
          GCCH_2s (ch));
     return;
   }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Retransmitting OPEN_ACK on channel %s\n",
+       GCCH_2s (ch));
   ch->retry_control_task
     = GNUNET_SCHEDULER_add_now (&send_open_ack,
                                 ch);
@@ -814,6 +825,9 @@ GCCH_bind (struct CadetChannel *ch,
 void
 GCCH_channel_local_destroy (struct CadetChannel *ch)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Local client asks for destruction of %s which it initiated\n",
+       GCCH_2s (ch));
   if (GNUNET_YES == ch->destroy)
   {
     /* other end already destroyed, with the local client gone, no need
@@ -845,6 +859,9 @@ GCCH_channel_local_destroy (struct CadetChannel *ch)
 void
 GCCH_channel_incoming_destroy (struct CadetChannel *ch)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Local client asks for destruction of %s which it accepted\n",
+       GCCH_2s (ch));
   if (GNUNET_YES == ch->destroy)
   {
     /* other end already destroyed, with the remote client gone, no need
@@ -1057,6 +1074,9 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
   {
     /* ACK for message we already dropped, might have been a
        duplicate ACK? Ignore. */
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Duplicate DATA_ACK on %s, ignoring\n",
+         GCCH_2s (ch));
     GNUNET_STATISTICS_update (stats,
                               "# duplicate DATA_ACKs",
                               1,
@@ -1069,6 +1089,11 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
   ch->pending_messages--;
   GNUNET_free (crm);
   GNUNET_assert (ch->pending_messages < ch->max_pending_messages);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Received DATA_ACK on %s for message %u (%u ACKs pending)\n",
+       GCCH_2s (ch),
+       (unsigned int) ntohl (ack->mid.mid),
+       ch->pending_messages);
   send_ack_to_client (ch,
                       (NULL == ch->owner) ? ch->dest : ch->owner);
 }
index 7090d44108e6fcdfb7e453716ff4cd822c538dee..68d557d1c73654259535bfbb06880ec4985deac0 100644 (file)
@@ -497,7 +497,12 @@ struct GNUNET_CADET_ChannelTunnelNumber
 {
   /**
    * Which number does this channel have that uniquely identfies
-   * it within its tunnel?
+   * it within its tunnel, in network byte order.
+   *
+   * Given two peers, both may initiate channels over the same tunnel.
+   * The @e cn must be greater or equal to 0x80000000 (high-bit set)
+   * for tunnels initiated with the peer that has the larger peer
+   * identity as compared using #GNUNET_CRYPTO_cmp_peer_identity().
    */
   uint32_t cn GNUNET_PACKED;
 };