gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11933 - gnunet/src/dv


From: gnunet
Subject: [GNUnet-SVN] r11933 - gnunet/src/dv
Date: Thu, 24 Jun 2010 16:39:48 +0200

Author: nevans
Date: 2010-06-24 16:39:48 +0200 (Thu, 24 Jun 2010)
New Revision: 11933

Modified:
   gnunet/src/dv/dv_api.c
Log:
move client listen call into transmit start callback, so we know service exists 
and is connected... otherwise we may stop listening before the service starts

Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c      2010-06-24 13:50:48 UTC (rev 11932)
+++ gnunet/src/dv/dv_api.c      2010-06-24 14:39:48 UTC (rev 11933)
@@ -178,7 +178,7 @@
   ret->client = GNUNET_CLIENT_connect (ret->sched, "dv", ret->cfg);
   if (ret->client != NULL)
     return GNUNET_YES;
-#if DEBUG_STATISTICS
+#if DEBUG_DV_MESSAGES
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               _("Failed to connect to the dv service!\n"));
 #endif
@@ -351,6 +351,9 @@
 
   if (msg == NULL)
   {
+#if DEBUG_DV_MESSAGES
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: connection closed\n");
+#endif
     return; /* Connection closed? */
   }
 
@@ -373,7 +376,7 @@
     packed_msg = GNUNET_malloc(packed_msg_len);
     memcpy(packed_msg, &packed_msg_start[sender_address_len], packed_msg_len);
 
-#if DEBUG_DV
+#if DEBUG_DV_MESSAGES
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: packed message type: 
%d or %d\n", ntohs(((struct GNUNET_MessageHeader *)packed_msg)->type), ((struct 
GNUNET_MessageHeader *)packed_msg)->type);
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: message sender 
reported as %s\n", GNUNET_i2s(&received_msg->sender));
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: distance is %u\n", 
ntohl(received_msg->distance));
@@ -496,7 +499,9 @@
   struct StartContext *start_context = cls;
   struct GNUNET_DV_Handle *handle = start_context->handle;
   size_t tsize;
-
+#if DEBUG_DV
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV API: sending start request to 
service\n");
+#endif
   if (buf == NULL)
     {
       GNUNET_free(start_context->message);
@@ -511,6 +516,11 @@
     memcpy(buf, start_context->message, tsize);
     GNUNET_free(start_context->message);
     GNUNET_free(start_context);
+    GNUNET_CLIENT_receive (handle->client,
+                           &handle_message_receipt,
+                           handle, GNUNET_TIME_UNIT_FOREVER_REL);
+
+
     return tsize;
   }
 
@@ -568,10 +578,6 @@
 
   handle->send_callbacks = GNUNET_CONTAINER_multihashmap_create(100);
 
-  GNUNET_CLIENT_receive (handle->client,
-                         &handle_message_receipt,
-                         handle, GNUNET_TIME_UNIT_FOREVER_REL);
-
   return handle;
 }
 




reply via email to

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