Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / dht / dht_api.c
index 0ada4166269c8d604ea5d6a561739c8adbae6a5d..ee208b50e73770341630419fd71f1e95142e33f0 100644 (file)
@@ -503,7 +503,7 @@ check_monitor_get (void *cls,
   uint16_t msize = ntohs (msg->header.size) - sizeof (*msg);
 
   if ( (plen > UINT16_MAX) ||
-       (plen * sizeof (struct GNUNET_HashCode) != msize) )
+       (plen * sizeof (struct GNUNET_PeerIdentity) != msize) )
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -754,12 +754,25 @@ process_client_result (void *cls,
   meta_length =
       sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length);
   data_length = msize - meta_length;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Giving %u byte reply for %s to application\n",
-       (unsigned int) data_length,
-       GNUNET_h2s (key));
   put_path = (const struct GNUNET_PeerIdentity *) &crm[1];
   get_path = &put_path[put_path_length];
+  {
+    char *pp;
+    char *gp;
+
+    gp = GNUNET_STRINGS_pp2s (get_path,
+                              get_path_length);
+    pp = GNUNET_STRINGS_pp2s (put_path,
+                              put_path_length);
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n",
+         (unsigned int) data_length,
+         GNUNET_h2s (key),
+         gp,
+         pp);
+    GNUNET_free (gp);
+    GNUNET_free (pp);
+  }
   data = &get_path[get_path_length];
   /* remember that we've seen this result */
   GNUNET_CRYPTO_hash (data,
@@ -842,32 +855,32 @@ handle_put_confirmation (void *cls,
 static int
 try_connect (struct GNUNET_DHT_Handle *h)
 {
-  GNUNET_MQ_hd_var_size (monitor_get,
-                         GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET,
-                         struct GNUNET_DHT_MonitorGetMessage);
-  GNUNET_MQ_hd_var_size (monitor_get_resp,
-                         GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP,
-                         struct GNUNET_DHT_MonitorGetRespMessage);
-  GNUNET_MQ_hd_var_size (monitor_put,
-                         GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT,
-                         struct GNUNET_DHT_MonitorPutMessage);
-  GNUNET_MQ_hd_var_size (client_result,
-                         GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT,
-                         struct GNUNET_DHT_ClientResultMessage);
-  GNUNET_MQ_hd_fixed_size (put_confirmation,
-                           GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK,
-                           struct GNUNET_DHT_ClientPutConfirmationMessage);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_monitor_get_handler (h),
-    make_monitor_get_resp_handler (h),
-    make_monitor_put_handler (h),
-    make_client_result_handler (h),
-    make_put_confirmation_handler (h),
+    GNUNET_MQ_hd_var_size (monitor_get,
+                           GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET,
+                           struct GNUNET_DHT_MonitorGetMessage,
+                           h),
+    GNUNET_MQ_hd_var_size (monitor_get_resp,
+                           GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP,
+                           struct GNUNET_DHT_MonitorGetRespMessage,
+                           h),
+    GNUNET_MQ_hd_var_size (monitor_put,
+                           GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT,
+                           struct GNUNET_DHT_MonitorPutMessage,
+                           h),
+    GNUNET_MQ_hd_var_size (client_result,
+                           GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT,
+                           struct GNUNET_DHT_ClientResultMessage,
+                           h),
+    GNUNET_MQ_hd_fixed_size (put_confirmation,
+                             GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK,
+                             struct GNUNET_DHT_ClientPutConfirmationMessage,
+                             h),
     GNUNET_MQ_handler_end ()
   };
   if (NULL != h->mq)
     return GNUNET_OK;
-  h->mq = GNUNET_CLIENT_connecT (h->cfg,
+  h->mq = GNUNET_CLIENT_connect (h->cfg,
                                  "dht",
                                  handlers,
                                  &mq_error_handler,