gnunet-svn
[Top][All Lists]
Advanced

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

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


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

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

Modified:
   gnunet/src/peerinfo/peerinfo_api.c
Log:
nicer logging

Modified: gnunet/src/peerinfo/peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/peerinfo_api.c  2010-05-25 15:53:05 UTC (rev 11504)
+++ gnunet/src/peerinfo/peerinfo_api.c  2010-05-25 15:53:30 UTC (rev 11505)
@@ -226,12 +226,9 @@
   h->th = NULL;
   if (buf == NULL)
     {
-#if DEBUG_PEERINFO
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  _
-                  ("Failed to transmit message of type %u to `%s' service.\n"),
-                  ntohs (msg->type), "peerinfo");
-#endif
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  _("Failed to transmit message to `%s' service.\n"),
+                 "PEERINFO");
       if (tqe != NULL)
        GNUNET_CONTAINER_DLL_remove (h->tq_head,
                                     h->tq_tail,
@@ -249,7 +246,13 @@
   ret = tqe->size;
   GNUNET_assert (size >= ret);
   memcpy (buf, &tqe[1], ret);
-  GNUNET_CONTAINER_DLL_remove (h->tq_head,
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Transmitting request of size %u to `%s' service.\n",
+             ret, 
+             "PEERINFO");
+#endif
+   GNUNET_CONTAINER_DLL_remove (h->tq_head,
                               h->tq_tail,
                               tqe);
   if (tqe->cont != NULL)
@@ -387,7 +390,7 @@
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _("Failed to receive response from `%s' service.\n"),
-                  "peerinfo");
+                  "PEERINFO");
       reconnect (ic->h);
       trigger_transmit (ic->h);
       if (ic->timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -402,7 +405,8 @@
     {
 #if DEBUG_PEERINFO
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Received end of list of peers from peerinfo database\n");
+                 "Received end of list of peers from `%s' service\n",
+                 "PEERINFO");
 #endif
       trigger_transmit (ic->h);
       if (ic->timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -449,10 +453,11 @@
     }
 #if DEBUG_PEERINFO
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Received %u bytes of `%s' information about peer `%s' from 
PEERINFO database\n",
+             "Received %u bytes of `%s' information about peer `%s' from `%s' 
service\n",
              (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello),
              "HELLO",
-             GNUNET_i2s (&im->peer));
+             GNUNET_i2s (&im->peer),
+             "PEERINFO");
 #endif
   ic->h->in_receive = GNUNET_YES;
   if (ic->callback != NULL)
@@ -479,6 +484,10 @@
 
   if (GNUNET_OK != transmit_success)
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                 _("Failed to transmit iteration request to `%s' service 
(%d).\n"),
+                 "PEERINFO",
+                 transmit_success);
       if (ic->timeout_task != GNUNET_SCHEDULER_NO_TASK)
        {
          GNUNET_SCHEDULER_cancel (ic->h->sched,
@@ -487,10 +496,16 @@
        }
       reconnect (ic->h);
       trigger_transmit (ic->h);
-      ic->callback (ic->callback_cls, NULL, NULL, 1);
+      if (ic->callback != NULL)
+       ic->callback (ic->callback_cls, NULL, NULL, 1);
       GNUNET_free (ic);
       return;
     }  
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Waiting for response from `%s' service.\n",
+             "PEERINFO");
+#endif
   ic->h->in_receive = GNUNET_YES;
   ic->in_receive = GNUNET_YES;
   ic->tqe = NULL;
@@ -513,6 +528,9 @@
 {
   struct GNUNET_PEERINFO_IteratorContext *ic = cls;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+             _("Timeout transmitting iteration request to `%s' service.\n"),
+             "PEERINFO");
   ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   if (! ic->in_receive)
     GNUNET_CONTAINER_DLL_remove (ic->h->tq_head,
@@ -562,12 +580,12 @@
   struct GNUNET_PEERINFO_IteratorContext *ic;
   struct TransmissionQueueEntry *tqe;
 
+  if (peer == NULL)
+    {
 #if DEBUG_PEERINFO
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Requesting list of peers from peerinfo database\n");
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Requesting list of peers from PEERINFO service\n");
 #endif
-  if (peer == NULL)
-    {
       tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) +
                           sizeof (struct ListAllPeersMessage));
       tqe->size = sizeof (struct ListAllPeersMessage);
@@ -578,6 +596,11 @@
     }
   else
     {
+#if DEBUG_PEERINFO
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Requesting information on peer `%4s' from PEERINFO 
service\n",
+                 GNUNET_i2s (peer));
+#endif
       tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) +
                           sizeof (struct ListPeerMessage));
       tqe->size = sizeof (struct ListPeerMessage);




reply via email to

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