gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8645 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r8645 - gnunet/src/transport
Date: Wed, 8 Jul 2009 15:32:38 -0600

Author: grothoff
Date: 2009-07-08 15:32:37 -0600 (Wed, 08 Jul 2009)
New Revision: 8645

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/transport.h
Log:
nicer debug code

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2009-07-08 18:54:19 UTC 
(rev 8644)
+++ gnunet/src/transport/gnunet-service-transport.c     2009-07-08 21:32:37 UTC 
(rev 8645)
@@ -1107,6 +1107,11 @@
     {
       rl->connect_attempts++;
       rl->connected = GNUNET_YES;
+#if DEBUG_TRANSPORT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Establishing fresh connection with `%4s' via plugin `%s'\n",
+              GNUNET_i2s (&neighbour->id), rl->plugin->short_name);
+#endif
     }
   neighbour->messages = mq->next;
   mq->plugin = rl->plugin;
@@ -1242,7 +1247,8 @@
 
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-              "Refreshing my HELLO\n");
+              "Refreshing my `%s'\n",
+             "HELLO");
 #endif
   gc.plug_pos = plugins;
   gc.addr_pos = plugins != NULL ? plugins->addresses : NULL;
@@ -1263,6 +1269,12 @@
   npos = neighbours;
   while (npos != NULL)
     {
+#if DEBUG_TRANSPORT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+                 "Transmitting updated `%s' to neighbour `%4s'\n",
+                 "HELLO",
+                 GNUNET_i2s(&npos->id));
+#endif
       transmit_to_peer (NULL, 0,
                         (const struct GNUNET_MessageHeader *) our_hello,
                         GNUNET_YES, npos);
@@ -1384,11 +1396,6 @@
   struct AddressList *al;
   struct GNUNET_TIME_Absolute abex;
 
-#if DEBUG_TRANSPORT
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Plugin `%s' informs us about a new address `%s'\n", name,
-             GNUNET_a2s(addr, addrlen));
-#endif
   abex = GNUNET_TIME_relative_to_absolute (expires);
   GNUNET_assert (p == find_transport (name));
 
@@ -1403,6 +1410,11 @@
         }
       al = al->next;
     }
+#if DEBUG_TRANSPORT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Plugin `%s' informs us about a new address `%s'\n", name,
+             GNUNET_a2s(addr, addrlen));
+#endif
   al = GNUNET_malloc (sizeof (struct AddressList) + addrlen);
   al->addr = &al[1];
   al->next = p->addresses;
@@ -2319,12 +2331,14 @@
     case GNUNET_MESSAGE_TYPE_HELLO:
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Receiving `%s' message from other peer.\n", "HELLO");
+                  "Receiving `%s' message from `%4s'.\n", "HELLO",
+                 GNUNET_i2s(peer));
 #endif
       process_hello (plugin, message);
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Sending `%s' message to connecting peer.\n", "ACK");
+                  "Sending `%s' message to connecting peer `%4s'.\n", "ACK",
+                 GNUNET_i2s(peer));
 #endif
       transmit_to_peer (NULL, 0, &ack, GNUNET_YES, n);
       break;
@@ -2340,8 +2354,9 @@
     default:
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received message of type %u from other peer, sending to all 
clients.\n",
-                  ntohs (message->type));
+                  "Received message of type %u from `%4s', sending to all 
clients.\n",
+                  ntohs (message->type),
+                 GNUNET_i2s(peer));
 #endif
       /* transmit message to all clients */
       im = GNUNET_malloc (sizeof (struct InboundMessage) + msize);

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2009-07-08 18:54:19 UTC (rev 
8644)
+++ gnunet/src/transport/plugin_transport_tcp.c 2009-07-08 21:32:37 UTC (rev 
8645)
@@ -38,7 +38,7 @@
 #include "plugin_transport.h"
 #include "transport.h"
 
-#define DEBUG_TCP GNUNET_NO
+#define DEBUG_TCP GNUNET_YES
 
 /**
  * After how long do we expire an address that we
@@ -1368,11 +1368,6 @@
   void *vaddr;
   const struct sockaddr *addr;
 
-#if DEBUG_TCP
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                   "tcp",
-                   "Received `%s' message from %p.\n", "WELCOME", client);
-#endif
   msize = ntohs (message->size);
   if (msize < sizeof (struct WelcomeMessage))
     {
@@ -1381,6 +1376,13 @@
       return;
     }
   wm = (const struct WelcomeMessage *) message;
+#if DEBUG_TCP
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                   "tcp",
+                   "Received `%s' message from `%4s/%p'.\n", "WELCOME",
+                  GNUNET_i2s(&wm->clientIdentity),
+                  client);
+#endif
   session_c = find_session_by_client (plugin, client);
   if (session_c == NULL)
     {
@@ -1478,10 +1480,6 @@
   struct GNUNET_TIME_Relative delay;
   uint64_t ack_in;
 
-#if DEBUG_TCP
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                   "tcp", "Receiving data from other peer.\n");
-#endif
   msize = ntohs (message->size);
   if ((msize <
        sizeof (struct DataMessage) + sizeof (struct GNUNET_MessageHeader)))
@@ -1497,6 +1495,12 @@
       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
+#if DEBUG_TCP
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                   "tcp", "Receiving %u bytes from `%4s'.\n",
+                  msize,
+                  GNUNET_i2s(&session->target));
+#endif
   dm = (const struct DataMessage *) message;
   session->max_in_msg_counter = GNUNET_MAX (session->max_in_msg_counter,
                                             GNUNET_ntohll (dm->ack_out));

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2009-07-08 18:54:19 UTC (rev 8644)
+++ gnunet/src/transport/transport.h    2009-07-08 21:32:37 UTC (rev 8645)
@@ -27,7 +27,7 @@
 #include "gnunet_time_lib.h"
 #include "gnunet_transport_service.h"
 
-#define DEBUG_TRANSPORT GNUNET_NO
+#define DEBUG_TRANSPORT GNUNET_YES
 
 /**
  * For how long do we allow unused bandwidth





reply via email to

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