gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29583 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r29583 - gnunet/src/ats
Date: Thu, 26 Sep 2013 11:17:32 +0200

Author: wachs
Date: 2013-09-26 11:17:31 +0200 (Thu, 26 Sep 2013)
New Revision: 29583

Modified:
   gnunet/src/ats/ats_api_performance.c
Log:
race condition between APIs due to different locations for the client_receive 
call: performance and scheduling now work the same


Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c        2013-09-26 09:16:26 UTC (rev 
29582)
+++ gnunet/src/ats/ats_api_performance.c        2013-09-26 09:17:31 UTC (rev 
29583)
@@ -274,6 +274,16 @@
 
 
 /**
+ * Type of a function to call when we receive a message
+ * from the service.
+ *
+ * @param cls the 'struct GNUNET_ATS_SchedulingHandle'
+ * @param msg message received, NULL on timeout or fatal error
+ */
+static void
+process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg);
+
+/**
  * We can now transmit a message to ATS. Do it.
  *
  * @param cls the 'struct GNUNET_ATS_SchedulingHandle'
@@ -298,6 +308,9 @@
     ret += p->size;
     size -= p->size;
     GNUNET_CONTAINER_DLL_remove (ph->pending_head, ph->pending_tail, p);
+    GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
+                            GNUNET_TIME_UNIT_FOREVER_REL);
+
     GNUNET_free (p);
   }
   do_transmit (ph);
@@ -609,8 +622,6 @@
   GNUNET_assert (NULL == ph->client);
   ph->client = GNUNET_CLIENT_connect ("ats", ph->cfg);
   GNUNET_assert (NULL != ph->client);
-  GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
-                         GNUNET_TIME_UNIT_FOREVER_REL);
   if ((NULL == (p = ph->pending_head)) || (GNUNET_YES != p->is_init))
   {
     p = GNUNET_malloc (sizeof (struct PendingMessage) +




reply via email to

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