gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36447 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r36447 - gnunet/src/cadet
Date: Tue, 6 Oct 2015 14:03:14 +0200

Author: bartpolot
Date: 2015-10-06 14:03:14 +0200 (Tue, 06 Oct 2015)
New Revision: 36447

Modified:
   gnunet/src/cadet/cadet_common.c
   gnunet/src/cadet/gnunet-service-cadet_channel.c
   gnunet/src/cadet/gnunet-service-cadet_connection.c
   gnunet/src/cadet/gnunet-service-cadet_peer.c
   gnunet/src/cadet/gnunet-service-cadet_peer.h
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
- Revamp traffic logging, small bugfixes, complete doxygen

Modified: gnunet/src/cadet/cadet_common.c
===================================================================
--- gnunet/src/cadet/cadet_common.c     2015-10-06 02:08:16 UTC (rev 36446)
+++ gnunet/src/cadet/cadet_common.c     2015-10-06 12:03:14 UTC (rev 36447)
@@ -47,7 +47,7 @@
   else
   {
     /* Not an error, can happen with CONNECTION_BROKEN messages. */
-    return "";
+    return "\???";
   }
 }
 
@@ -146,7 +146,7 @@
      * Used to mark the "payload" of a non-payload message.
      */
     case 0:
-      s = "retrnsmit";
+      s = "retransmit";
       break;
 
       /**
@@ -380,8 +380,16 @@
       s = "INFO_DUMP";
       break;
 
+      /**
+       * Used to mark the "payload" of a non-payload message.
+       */
+    case UINT16_MAX:
+      s = "      N/A";
+      break;
+
+
     default:
-      SPRINTF (buf[idx], "%u (UNKNOWN)", m);
+      SPRINTF (buf[idx], "{UNK: %5u}", m);
       return buf[idx];
   }
   SPRINTF (buf[idx], "{%10s}", s);

Modified: gnunet/src/cadet/gnunet-service-cadet_channel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_channel.c     2015-10-06 02:08:16 UTC 
(rev 36446)
+++ gnunet/src/cadet/gnunet-service-cadet_channel.c     2015-10-06 12:03:14 UTC 
(rev 36447)
@@ -1041,7 +1041,7 @@
 
   bitfield = msg->futures;
   mid = ntohl (msg->mid);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable %u %llX\n", mid, bitfield);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable %u %lX\n", mid, bitfield);
   LOG (GNUNET_ERROR_TYPE_DEBUG, " rel %p, head %p\n", rel, rel->head_sent);
   for (i = 0, r = 0, copy = rel->head_sent;
        i < 64 && NULL != copy && 0 != bitfield;
@@ -1561,11 +1561,9 @@
     mask = 0x1LL << delta;
     msg.futures |= mask;
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         " setting bit for %u (delta %u) (%llX) -> %llX\n",
+         " setting bit for %u (delta %u) (%lX) -> %lX\n",
          copy->mid, delta, mask, msg.futures);
   }
-  LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u + %llX\n",
-       ack, msg.futures);
 
   GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n");
@@ -1859,7 +1857,7 @@
   CADET_ChannelNumber chid;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  towards %s:%u\n",
-              GNUNET_i2s (&msg->peer), ntohl (msg->port));
+       GNUNET_i2s (&msg->peer), ntohl (msg->port));
   chid = ntohl (msg->channel_id);
 
   /* Sanity check for duplicate channel IDs */
@@ -1924,7 +1922,10 @@
 {
   struct CadetChannelReliability *rel;
   struct CadetClient *c;
+  struct GNUNET_MessageHeader *payload_msg;
   uint32_t mid;
+  uint16_t payload_type;
+  uint16_t payload_size;
 
   /* If this is a remote (non-loopback) channel, find 'fwd'. */
   if (GNUNET_SYSERR == fwd)
@@ -1965,18 +1966,22 @@
     channel_confirm (ch, GNUNET_NO);
   }
 
-  GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO);
+  payload_msg = (struct GNUNET_MessageHeader *) &msg[1];
+  payload_type = ntohs (payload_msg->type);
+  payload_size = ntohs (payload_msg->size);
 
+  GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO);
+  GNUNET_STATISTICS_update (stats, "# bytes received", payload_size, 
GNUNET_NO);
+
   mid = ntohl (msg->mid);
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== DATA %u %s on channel %s\n",
-       mid, GC_f2s (fwd), GCCH_2s (ch));
+  LOG (GNUNET_ERROR_TYPE_INFO, "<== %s (%s %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_DATA), GC_m2s (payload_type), mid,
+       GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
 
   if (GNUNET_NO == ch->reliable ||
       ( !GC_is_pid_bigger (rel->mid_recv, mid) &&
         GC_is_pid_bigger (rel->mid_recv + 64, mid) ) )
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "RECV MID %u (%u)\n",
-         mid, ntohs (msg->header.size));
     if (GNUNET_YES == ch->reliable)
     {
       /* Is this the exact next expected messasge? */
@@ -2063,8 +2068,10 @@
   }
 
   ack = ntohl (msg->mid);
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u + %llX\n",
-       GC_f2s (fwd), ack, msg->futures);
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "<== %s (0x%010lX %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK), msg->futures, ack,
+       GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
 
   if (GNUNET_YES == fwd)
     rel = ch->root_rel;
@@ -2151,8 +2158,10 @@
   struct CadetChannel *ch;
   struct CadetClient *c;
   int new_channel;
+  uint32_t port;
 
   chid = ntohl (msg->chid);
+
   ch = GCT_get_channel (t, chid);
   if (NULL == ch)
   {
@@ -2166,11 +2175,17 @@
   {
     new_channel = GNUNET_NO;
   }
+  port = ntohl (msg->port);
 
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "<== %s (  0x%08X %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE), chid, port,
+       GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size));
+
   if (GNUNET_YES == new_channel || GCT_is_loopback (t))
   {
     /* Find a destination client */
-    ch->port = ntohl (msg->port);
+    ch->port = port;
     LOG (GNUNET_ERROR_TYPE_DEBUG, "   port %u\n", ch->port);
     c = GML_client_get_by_port (ch->port);
     if (NULL == c)
@@ -2235,6 +2250,11 @@
 void
 GCCH_handle_nack (struct CadetChannel *ch)
 {
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "<== %s (  0x%08X %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK), ch->gid, 0,
+       GCCH_2s (ch), ch, "---", 0);
+
   send_client_nack (ch);
   GCCH_destroy (ch);
 }
@@ -2255,6 +2275,11 @@
                  const struct GNUNET_CADET_ChannelManage *msg,
                  int fwd)
 {
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "<== %s (  0x%08X %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK), ch->gid, 0,
+       GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
+
   /* If this is a remote (non-loopback) channel, find 'fwd'. */
   if (GNUNET_SYSERR == fwd)
   {
@@ -2288,6 +2313,11 @@
 {
   struct CadetChannelReliability *rel;
 
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "<== %s (  0x%08X %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY), ch->gid, 0,
+       GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
+
   /* If this is a remote (non-loopback) channel, find 'fwd'. */
   if (GNUNET_SYSERR == fwd)
   {
@@ -2342,12 +2372,65 @@
                             void *existing_copy)
 {
   struct CadetChannelQueue *chq;
+  uint32_t data_id;
   uint16_t type;
+  uint16_t size;
+  char info[32];
 
   type = ntohs (message->type);
-  LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %s on channel %s\n",
-       GC_m2s (type), GC_f2s (fwd), GCCH_2s (ch));
+  size = ntohs (message->size);
 
+  switch (type)
+  {
+    case GNUNET_MESSAGE_TYPE_CADET_DATA:
+    {
+      struct GNUNET_CADET_Data *data_msg;
+      struct GNUNET_MessageHeader *payload_msg;
+      uint16_t payload_type;
+
+      data_msg = (struct GNUNET_CADET_Data *) message;
+      data_id = ntohl (data_msg->mid);
+      payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1];
+      payload_type = ntohs (payload_msg->type);
+      strncpy (info, GC_m2s (payload_type), 31);
+      info[31] = '\0';
+      break;
+    }
+    case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+    {
+      struct GNUNET_CADET_DataACK *ack_msg;
+      ack_msg = (struct GNUNET_CADET_DataACK *) message;
+      data_id = ntohl (ack_msg->mid);
+      SPRINTF (info, "0x%010lX", ack_msg->futures);
+      break;
+    }
+    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+    {
+      struct GNUNET_CADET_ChannelCreate *cc_msg;
+      cc_msg = (struct GNUNET_CADET_ChannelCreate *) message;
+      data_id = ntohl (cc_msg->port);
+      SPRINTF (info, "  0x%08X", ntohl (cc_msg->chid));
+      break;
+    }
+    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
+    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
+    case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
+    {
+      struct GNUNET_CADET_ChannelManage *m_msg;
+      m_msg = (struct GNUNET_CADET_ChannelManage *) message;
+      data_id = 0;
+      SPRINTF (info, "  0x%08X", ntohl (m_msg->chid));
+      break;
+    }
+    default:
+      data_id = 0;
+      info[0] = '\0';
+  }
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "==> %s (%12s %4u) on chan %s (%p) %s [%5u]\n",
+       GC_m2s (type), info, data_id,
+       GCCH_2s (ch), ch, GC_f2s (fwd), size);
+
   if (GCT_is_loopback (ch->t))
   {
     handle_loopback (ch, message, fwd);
@@ -2356,12 +2439,7 @@
 
   switch (type)
   {
-    struct GNUNET_CADET_Data *payload;
     case GNUNET_MESSAGE_TYPE_CADET_DATA:
-
-      payload = (struct GNUNET_CADET_Data *) message;
-      LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n",
-           GC_m2s (type), ntohl (payload->mid));
       if (GNUNET_YES == ch->reliable)
       {
         chq = GNUNET_new (struct CadetChannelQueue);
@@ -2450,7 +2528,7 @@
 
     default:
       GNUNET_break (0);
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s unknown!\n", GC_m2s (type));
+      LOG (GNUNET_ERROR_TYPE_WARNING, "type %s unknown!\n", GC_m2s (type));
       fire_and_forget (message, ch, GNUNET_YES);
   }
 }

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-10-06 02:08:16 UTC 
(rev 36446)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-10-06 12:03:14 UTC 
(rev 36447)
@@ -589,8 +589,8 @@
   msg.ack = htonl (ack);
   msg.cid = c->id;
 
-  prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, 0, ack, c,
-                                                !fwd, GNUNET_YES,
+  prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, UINT16_MAX, ack,
+                                                c, !fwd, GNUNET_YES,
                                                 &ack_sent, prev_fc);
   GNUNET_assert (NULL != prev_fc->ack_msg);
   GCC_check_connections ();
@@ -966,15 +966,16 @@
 send_connection_ack (struct CadetConnection *connection, int fwd)
 {
   struct CadetTunnel *t;
+  size_t size = sizeof (struct GNUNET_CADET_ConnectionACK);
 
   GCC_check_connections ();
   t = connection->t;
-  LOG (GNUNET_ERROR_TYPE_INFO, "--> {%14s ACK} on conn %s\n",
-       GC_f2s (!fwd), GCC_2s (connection));
+  LOG (GNUNET_ERROR_TYPE_INFO,
+       "==> { C %s ACK} %19s on conn %s (%p) %s [%5u]\n",
+       GC_f2s (!fwd), "", GCC_2s (connection), connection, GC_f2s (fwd), size);
   GCP_queue_add (get_hop (connection, fwd), NULL,
-                 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, 0,
-                 sizeof (struct GNUNET_CADET_ConnectionACK),
-                 connection, fwd, &conn_message_sent, NULL);
+                 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, UINT16_MAX, 0,
+                 size, connection, fwd, &conn_message_sent, NULL);
   connection->pending_messages++;
   if (CADET_TUNNEL_NEW == GCT_get_cstate (t))
     GCT_change_cstate (t, CADET_TUNNEL_WAITING);
@@ -1007,7 +1008,7 @@
   msg.peer1 = *id1;
   msg.peer2 = *id2;
   GNUNET_assert (NULL ==
-                 GCC_send_prebuilt_message (&msg.header, 0, 0, c, fwd,
+                 GCC_send_prebuilt_message (&msg.header, UINT16_MAX, 0, c, fwd,
                                             GNUNET_YES, NULL, NULL));
   GCC_check_connections ();
 }
@@ -1047,7 +1048,7 @@
   neighbor = GCP_get (peer_id, GNUNET_NO); /* We MUST know neighbor. */
   GNUNET_assert (NULL != neighbor);
   GCP_queue_add (neighbor, msg, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
-                 0, 2, sizeof (struct GNUNET_CADET_ConnectionBroken),
+                 UINT16_MAX, 2, sizeof (struct GNUNET_CADET_ConnectionBroken),
                  NULL, GNUNET_SYSERR, /* connection, fwd */
                  NULL, NULL); /* continuation */
   GCC_check_connections ();
@@ -1445,7 +1446,7 @@
   msg.pid = htonl (fc->last_pid_sent);
   LOG (GNUNET_ERROR_TYPE_DEBUG, " last pid sent: %u\n", fc->last_pid_sent);
   fc->poll_msg =
-      GCC_send_prebuilt_message (&msg.header, 0, fc->last_pid_sent, c,
+      GCC_send_prebuilt_message (&msg.header, UINT16_MAX, fc->last_pid_sent, c,
                                  fc == &c->fwd_fc, GNUNET_YES, &poll_sent, fc);
   GNUNET_assert (NULL != fc->poll_msg);
   GCC_check_connections ();
@@ -1912,12 +1913,24 @@
              const struct GNUNET_CADET_Hash *hash)
 {
   uint16_t size;
+  uint16_t type;
+  char *arrow;
 
   size = ntohs (message->size);
-  LOG (GNUNET_ERROR_TYPE_INFO, "\n");
-  LOG (GNUNET_ERROR_TYPE_INFO, "\n");
-  LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on conn %s from %s, %6u bytes\n",
-       GC_m2s (ntohs (message->type)), GNUNET_h2s (GC_h2hc (hash)),
+  type = ntohs (message->type);
+  switch (type)
+  {
+    case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+    case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
+    case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
+    case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
+      arrow = "==";
+      break;
+    default:
+      arrow = "--";
+  }
+  LOG (GNUNET_ERROR_TYPE_INFO, "<%s %s on conn %s from %s, %6u bytes\n",
+       arrow, GC_m2s (type), GNUNET_h2s (GC_h2hc (hash)),
        GNUNET_i2s (peer), (unsigned int) size);
 }
 
@@ -2338,8 +2351,7 @@
   }
   else if (0 == c->pending_messages)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "  directly destroying connection!\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  directly destroying connection!\n");
     GCC_destroy (c);
     GCC_check_connections ();
     return GNUNET_OK;
@@ -3456,7 +3468,7 @@
   memcpy (data, message, size);
   type = ntohs (message->type);
   LOG (GNUNET_ERROR_TYPE_INFO,
-       "--> %s (%s %4u) on conn %s (%p) %s (%u bytes)\n",
+       "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
        GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,
        GC_f2s(fwd), size);
 
@@ -3620,9 +3632,9 @@
   size = sizeof (struct GNUNET_CADET_ConnectionCreate);
   size += connection->path->length * sizeof (struct GNUNET_PeerIdentity);
 
-  LOG (GNUNET_ERROR_TYPE_INFO, "--> %s on conn %s  (%u bytes)\n",
-       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE),
-       GCC_2s (connection), size);
+  LOG (GNUNET_ERROR_TYPE_INFO, "==> %s %19s on conn %s (%p) FWD [%5u]\n",
+       GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE), "",
+       GCC_2s (connection), connection, size);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  C_P+ %p %u (create)\n",
        connection, connection->pending_messages);
   connection->pending_messages++;
@@ -3629,7 +3641,7 @@
 
   connection->maintenance_q =
     GCP_queue_add (get_next_hop (connection), NULL,
-                   GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, 0,
+                   GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, UINT16_MAX, 0,
                    size, connection, GNUNET_YES, &conn_message_sent, NULL);
 
   state = GCT_get_cstate (connection->t);
@@ -3666,13 +3678,13 @@
               GCC_2s (c));
 
   if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES))
-    GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, 0, 0, c,
-                                                      GNUNET_YES, GNUNET_YES,
-                                                      NULL, NULL));
+    GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, UINT16_MAX,
+                                                      0, c, GNUNET_YES,
+                                                      GNUNET_YES, NULL, NULL));
   if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO))
-    GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, 0, 0, c,
-                                                      GNUNET_NO, GNUNET_YES,
-                                                      NULL, NULL));
+    GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, UINT16_MAX,
+                                                      0, c, GNUNET_NO,
+                                                      GNUNET_YES, NULL, NULL));
   c->destroy = GNUNET_YES;
   c->state = CADET_CONNECTION_DESTROYED;
   GCC_check_connections ();

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c        2015-10-06 02:08:16 UTC 
(rev 36446)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c        2015-10-06 12:03:14 UTC 
(rev 36447)
@@ -1219,7 +1219,7 @@
   wait_s = GNUNET_STRINGS_relative_time_to_string (core_wait_time, GNUNET_YES);
   if (core_wait_time.rel_value_us >= 1000000)
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
+    LOG (GNUNET_ERROR_TYPE_WARNING,
          " %s: core wait time %s (> 1 second) for %u bytes\n",
          GCP_2s (peer), wait_s, queue->size);
   }
@@ -1248,7 +1248,7 @@
     else
     {
       LOG (GNUNET_ERROR_TYPE_INFO,
-           ">>> %s (%s %4u) on conn %s (%p) %s (%u bytes), after %s\n",
+           ">>> %s (%s %4u) on conn %s (%p) %s [%5u], after %s\n",
            GC_m2s (queue->type), GC_m2s (queue->payload_type),
            queue->payload_id, GCC_2s (c), c,
            GC_f2s (queue->fwd), msg_size, wait_s);
@@ -1401,7 +1401,11 @@
  * @param peer Peer towards which to queue the message.
  * @param cls Closure (@c type dependant). It will be used by queue_send to
  *            build the message to be sent if not already prebuilt.
- * @param type Type of the message, 0 for a raw message.
+ * @param type Type of the message.
+ * @param payload_type Type of the message's payload
+ *                     0 if the message is a retransmission (unknown payload).
+ *                     UINT16_MAX if the message does not have payload.
+ * @param payload_id ID of the payload (MID, ACK #, etc)
  * @param size Size of the message.
  * @param c Connection this message belongs to (can be NULL).
  * @param fwd Is this a message going root->dest? (FWD ACK are NOT FWD!)

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.h        2015-10-06 02:08:16 UTC 
(rev 36446)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.h        2015-10-06 12:03:14 UTC 
(rev 36447)
@@ -170,9 +170,13 @@
  * @param peer Peer towards which to queue the message.
  * @param cls Closure (@c type dependant). It will be used by queue_send to
  *            build the message to be sent if not already prebuilt.
- * @param type Type of the message, 0 for a raw message.
+ * @param type Type of the message.
+ * @param payload_type Type of the message's payload
+ *                     0 if the message is a retransmission (unknown payload).
+ *                     UINT16_MAX if the message does not have payload.
+ * @param payload_id ID of the payload (MID, ACK #, etc)
  * @param size Size of the message.
- * @param c Connection this message belongs to (cannot be NULL).
+ * @param c Connection this message belongs to (can be NULL).
  * @param fwd Is this a message going root->dest? (FWD ACK are NOT FWD!)
  * @param cont Continuation to be called once CORE has taken the message.
  * @param cont_cls Closure for @c cont.
@@ -181,10 +185,16 @@
  *         message has been sent and therefore the handle is no longer valid.
  */
 struct CadetPeerQueue *
-GCP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type,
-               uint16_t payload_type, uint32_t payload_id,
-               size_t size, struct CadetConnection *c, int fwd,
-               GCP_sent cont, void *cont_cls);
+GCP_queue_add (struct CadetPeer *peer,
+               void *cls,
+               uint16_t type,
+               uint16_t payload_type,
+               uint32_t payload_id,
+               size_t size,
+               struct CadetConnection *c,
+               int fwd,
+               GCP_sent cont,
+               void *cont_cls);
 
 /**
  * Cancel all queued messages to a peer that belong to a certain connection.

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-10-06 02:08:16 UTC 
(rev 36446)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-10-06 12:03:14 UTC 
(rev 36447)
@@ -2276,7 +2276,7 @@
 static void
 send_ephemeral (struct CadetTunnel *t)
 {
-  LOG (GNUNET_ERROR_TYPE_INFO, "===> EPHM for %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "==> EPHM for %s\n", GCT_2s (t));
   if (NULL != t->ephm_h)
   {
     LOG (GNUNET_ERROR_TYPE_INFO, "     already queued\n");
@@ -2305,7 +2305,7 @@
 {
   struct GNUNET_CADET_KX_Pong msg;
 
-  LOG (GNUNET_ERROR_TYPE_INFO, "===> PONG for %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "==> PONG for %s\n", GCT_2s (t));
   if (NULL != t->pong_h)
   {
     LOG (GNUNET_ERROR_TYPE_INFO, "     already queued\n");
@@ -2560,7 +2560,7 @@
   }
   type = ntohs (msg[1].header.type);
   LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", GC_m2s (type));
-  sprintf (buf, "# received payload of type %hu", type);
+  SPRINTF (buf, "# received payload of type %hu", type);
   GNUNET_STATISTICS_update (stats, buf, 1, GNUNET_NO);
 
 
@@ -2570,8 +2570,7 @@
   {
     GNUNET_STATISTICS_update (stats, "# data on unknown channel",
                               1, GNUNET_NO);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel 0x%X unknown\n",
-         ntohl (msg->chid));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "channel 0x%X unknown\n", ntohl (msg->chid));
     send_channel_destroy (t, ntohl (msg->chid));
     return;
   }
@@ -2624,8 +2623,8 @@
 /**
  * Handle channel create.
  *
- * @param t Tunnel on which the data came.
- * @param msg Data message.
+ * @param t Tunnel on which the message came.
+ * @param msg ChannelCreate message.
  */
 static void
 handle_ch_create (struct CadetTunnel *t,
@@ -2638,7 +2637,7 @@
   size = ntohs (msg->header.size);
   if (size != sizeof (struct GNUNET_CADET_ChannelCreate))
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     return;
   }
 
@@ -2814,7 +2813,7 @@
 handle_ephemeral (struct CadetTunnel *t,
                   const struct GNUNET_CADET_KX_Ephemeral *msg)
 {
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "<== EPHM for %s\n", GCT_2s (t));
 
   /* Some old versions are still around, don't log as error. */
   if (GNUNET_OK != check_ephemeral (t, msg))
@@ -2900,7 +2899,7 @@
 {
   uint32_t challenge;
 
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "<== PONG for %s\n", GCT_2s (t));
   if (NULL == t->rekey_task)
   {
     GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, 
GNUNET_NO);
@@ -2952,7 +2951,7 @@
   const struct GNUNET_PeerIdentity *pid;
   int am_I_alice;
 
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== AX_KX on %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "<== {     AX_KX} on %s\n", GCT_2s (t));
 
   if (NULL == t->ax)
   {
@@ -3099,8 +3098,8 @@
   char buf[256];
 
   type = ntohs (msgh->type);
-  LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GC_m2s (type), GCT_2s (t));
-  sprintf (buf, "# received encrypted of type %hu (%s)", type, GC_m2s (type));
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "<-- %s on %s\n", GC_m2s (type), GCT_2s (t));
+  SPRINTF (buf, "# received encrypted of type %hu (%s)", type, GC_m2s (type));
   GNUNET_STATISTICS_update (stats, buf, 1, GNUNET_NO);
 
   switch (type)
@@ -4374,7 +4373,7 @@
   struct GNUNET_CADET_AX_KX msg;
   enum GNUNET_CADET_AX_KX_Flags flags;
 
-  LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "==> {     AX_KX} on %s\n", GCT_2s (t));
   if (NULL != t->ephm_h)
   {
     LOG (GNUNET_ERROR_TYPE_INFO, "     already queued\n");
@@ -4418,7 +4417,8 @@
     return;
   }
   fwd = GCC_is_origin (c, GNUNET_YES);
-  GNUNET_break (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd,
+  GNUNET_break (NULL == GCC_send_prebuilt_message (message, UINT16_MAX, 0,
+                                                   c, fwd,
                                                    GNUNET_YES, NULL, NULL));
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]