gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r38229 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r38229 - gnunet/src/testbed
Date: Thu, 27 Oct 2016 17:01:52 +0200

Author: harsha
Date: 2016-10-27 17:01:52 +0200 (Thu, 27 Oct 2016)
New Revision: 38229

Modified:
   gnunet/src/testbed/gnunet-service-testbed_barriers.c
   gnunet/src/testbed/testbed_api.c
Log:
propagate barrier status messages to sub controllers

Modified: gnunet/src/testbed/gnunet-service-testbed_barriers.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_barriers.c        2016-10-27 
13:00:37 UTC (rev 38228)
+++ gnunet/src/testbed/gnunet-service-testbed_barriers.c        2016-10-27 
15:01:52 UTC (rev 38229)
@@ -109,6 +109,11 @@
   struct Barrier *barrier;
 
   /**
+   * Handle to the slave controller where this wrapper creates a barrier
+   */
+  struct GNUNET_TESTBED_Controller *controller;
+
+  /**
    * The barrier handle from API
    */
   struct GNUNET_TESTBED_Barrier *hbarrier;
@@ -546,14 +551,7 @@
   struct WBarrier *wrapper = cls;
   struct Barrier *barrier = wrapper->barrier;
 
-  //FIXME: why are we removing the wrapper?  They should only be removed if 
they
-  //barrier is crossed or errored out
   GNUNET_assert (b_ == wrapper->hbarrier);
-  wrapper->hbarrier = NULL;
-  GNUNET_CONTAINER_DLL_remove (barrier->whead,
-                               barrier->wtail,
-                               wrapper);
-  GNUNET_free (wrapper);
   switch (status)
   {
   case GNUNET_TESTBED_BARRIERSTATUS_ERROR:
@@ -712,11 +710,12 @@
     }
     wrapper = GNUNET_new (struct WBarrier);
     wrapper->barrier = barrier;
+    wrapper->controller = slave->controller;
     GNUNET_CONTAINER_DLL_insert_tail (barrier->whead,
                                       barrier->wtail,
                                       wrapper);
-    //FIXME: Increment barrier->num_wbarriers
-    wrapper->hbarrier = GNUNET_TESTBED_barrier_init_ (slave->controller,
+    barrier->num_wbarriers++;
+    wrapper->hbarrier = GNUNET_TESTBED_barrier_init_ (wrapper->controller,
                                                       barrier->name,
                                                       barrier->quorum,
                                                       &wbarrier_status_cb,
@@ -868,6 +867,7 @@
   struct GNUNET_SERVICE_Client *client = cls;
   struct Barrier *barrier;
   struct ClientCtx *client_ctx;
+  struct WBarrier *wrapper;
   const char *name;
   struct GNUNET_HashCode key;
   uint16_t name_len;
@@ -907,7 +907,15 @@
     GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client_ctx->client),
                     env);
   }
-  //FIXME: Send status to wrappers if they exist
+  /**
+   * The wrapper barriers do not echo the barrier status, so we have to do it
+   * here
+   */
+  for (wrapper = barrier->whead; NULL != wrapper; wrapper = wrapper->next)
+  {
+    GNUNET_TESTBED_queue_message_ (wrapper->controller,
+                                   GNUNET_copy_message (&msg->header));
+  }
 }
 
 /* end of gnunet-service-testbed_barriers.c */

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2016-10-27 13:00:37 UTC (rev 38228)
+++ gnunet/src/testbed/testbed_api.c    2016-10-27 15:01:52 UTC (rev 38229)
@@ -1310,7 +1310,13 @@
 
  cleanup:
   GNUNET_free_non_null (emsg);
-  if (NULL != barrier)
+  /**
+   * Do not remove the barrier if we did not echo the status back; this is
+   * required at the chained testbed controller setup to ensure the only the
+   * test-driver echos the status and the controller hierarchy properly
+   * propagates the status.
+   */
+  if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
     GNUNET_TESTBED_barrier_remove_ (barrier);
 }
 




reply via email to

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