-add missing comments, expand error checking
[oweals/gnunet.git] / src / dht / dht_api.c
index a49af335bd6b97889e9b288758479dcadca91df6..31648a405fcf9b973679241314c59315588d0d08 100644 (file)
@@ -634,7 +634,11 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   if (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT)
   {
     if (process_monitor_message (handle, msg) == GNUNET_OK)
+    {
+      GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle,
+                             GNUNET_TIME_UNIT_FOREVER_REL);
       return;
+    }
     GNUNET_break (0);
     do_disconnect (handle);
     return;
@@ -985,6 +989,11 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
   pending->msg = &m->header;
   pending->handle = handle;
   pending->free_on_send = GNUNET_YES;
+  m->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET);
+  m->header.size = htons (sizeof (struct GNUNET_DHT_MonitorMessage));
+  m->type = htonl(type);
+  if (NULL != key)
+    memcpy (&m->key, key, sizeof(GNUNET_HashCode));
   GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
                                pending);
   pending->in_pending_queue = GNUNET_YES;