gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11504 - gnunet/src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r11504 - gnunet/src/peerinfo
Date: Tue, 25 May 2010 17:53:05 +0200

Author: grothoff
Date: 2010-05-25 17:53:05 +0200 (Tue, 25 May 2010)
New Revision: 11504

Modified:
   gnunet/src/peerinfo/gnunet-service-peerinfo.c
Log:
nicer logging

Modified: gnunet/src/peerinfo/gnunet-service-peerinfo.c
===================================================================
--- gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-05-25 15:52:17 UTC 
(rev 11503)
+++ gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-05-25 15:53:05 UTC 
(rev 11504)
@@ -496,9 +496,11 @@
   uint16_t hs;
   char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
   struct GNUNET_SERVER_TransmitContext *tc;
+  int match;
 
   tc = GNUNET_SERVER_transmit_context_create (client);
-  pos = hosts;
+  match = GNUNET_NO;
+  pos = hosts;  
   while (pos != NULL)
     {
       if ((only == NULL) ||
@@ -516,6 +518,7 @@
                              GNUNET_SERVER_MAX_MESSAGE_SIZE -
                              sizeof (struct InfoMessage));
               memcpy (&im[1], pos->hello, hs);
+             match = GNUNET_YES;
             }
          im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
          im->header.size = htons (sizeof (struct InfoMessage) + hs);
@@ -526,6 +529,12 @@
         }
       pos = pos->next;
     }
+  if ( (only != NULL) &&
+       (match == GNUNET_NO) )
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+               "No `%s' message was found for peer `%4s'\n",
+               "HELLO",
+               GNUNET_i2s (only));
   GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
                                              
GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
   GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -669,6 +678,12 @@
       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "`%s' message received for peer `%4s'\n",
+             "HELLO",
+             GNUNET_i2s (&pid));
+#endif
   bind_address (&pid, hello);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
@@ -689,6 +704,12 @@
   const struct ListPeerMessage *lpm;
 
   lpm = (const struct ListPeerMessage *) message;
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "`%s' message received for peer `%4s'\n",
+             "GET",
+             GNUNET_i2s (&lpm->peer));
+#endif
   send_to_each_host (&lpm->peer, ntohl (lpm->trust_change), client);
 }
 
@@ -708,6 +729,11 @@
   const struct ListAllPeersMessage *lpm;
 
   lpm = (const struct ListAllPeersMessage *) message;
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "`%s' message received\n",
+             "GET_ALL");
+#endif
   send_to_each_host (NULL, ntohl (lpm->trust_change), client);
 }
 
@@ -727,6 +753,11 @@
   struct InfoMessage *msg;
   struct HostEntry *pos;
 
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "`%s' message received\n",
+             "NOTIFY");
+#endif
   GNUNET_SERVER_notification_context_add (notify_list,
                                          client);
   pos = hosts;




reply via email to

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