support debugging
authorChristian Grothoff <christian@grothoff.org>
Mon, 11 Jan 2010 11:10:30 +0000 (11:10 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 11 Jan 2010 11:10:30 +0000 (11:10 +0000)
src/peerinfo/gnunet-peerinfo.c
src/peerinfo/peerinfo.h
src/peerinfo/peerinfo_api.c

index b5f41cc59d00aecfe820ee9610d5c4f2dd6ed027..931673ed979f0f4afb330210d995dfa448c538f9 100644 (file)
@@ -97,9 +97,15 @@ run (void *cls,
     {
       if (GNUNET_OK !=
           GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                                   "GNUNET",
-                                                   "HOSTKEYFILE", &fn))
-        return;
+                                                   "GNUNETD",
+                                                   "HOSTKEY", &fn))
+       {
+          fprintf (stderr, 
+                  _("Could not find option `%s:%s' in configuration.\n"), 
+                  "GNUNETD",
+                  "HOSTKEYFILE");
+         return;
+       }
       priv = GNUNET_CRYPTO_rsa_key_create_from_file (fn);
       if (priv == NULL)
         {
index 040b084e4cf42e7e750bbbc49e5ffe8f10cdffeb..607aad4db5a84b0010c8b4abf01d737c71d440d5 100644 (file)
@@ -27,6 +27,7 @@
 #include "gnunet_time_lib.h"
 #include "gnunet_peerinfo_service.h"
 
+#define DEBUG_PEERINFO GNUNET_NO
 
 /**
  * Add the given peer to the list.  This message
index f1fa4845aa3544f1186d48ce91fe388870b8e18e..b5c6c99d71680bff9c19a5dc912ad6cb0c1a7efd 100644 (file)
@@ -88,6 +88,11 @@ GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
   uint16_t hs;
   struct CAFContext *cc;
 
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Adding peer `%s' to peerinfo database\n",
+             GNUNET_i2s(peer));
+#endif
   client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg);
   if (client == NULL)
     {
@@ -168,6 +173,10 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     }
   if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END)
     {
+#if DEBUG_PEERINFO
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Received end of list of peers from peerinfo database\n");
+#endif
       ic->callback (ic->callback_cls, NULL, NULL, 0);
       GNUNET_CLIENT_disconnect (ic->client);
       GNUNET_free (ic);
@@ -197,6 +206,11 @@ info_handler (void *cls, const struct GNUNET_MessageHeader *msg)
           return;
         }
     }
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Received information about peer `%s' from peerinfo database\n",
+             GNUNET_i2s (&im->peer));
+#endif
   ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust));
   GNUNET_CLIENT_receive (ic->client,
                          &info_handler,
@@ -243,6 +257,10 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
       callback (callback_cls, NULL, NULL, 2);
       return;
     }
+#if DEBUG_PEERINFO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Requesting list of peers from peerinfo database\n");
+#endif
   ihc = GNUNET_malloc (sizeof (struct InfoContext) +
                        sizeof (struct ListPeerMessage));
   ihc->client = client;