aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2016-10-27 15:01:52 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2016-10-27 15:01:52 +0000
commita85d0779cb1dad2c5d2aecff2d5be96f1e11b665 (patch)
treeb0569b02721fda8b8cd67776fdc800611fc88000 /src/testbed
parent251c9287514c0e3a2cf6a3f6f978a27a49e65085 (diff)
propagate barrier status messages to sub controllers
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c28
-rw-r--r--src/testbed/testbed_api.c8
2 files changed, 25 insertions, 11 deletions
diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c
index 6382631034..a201d22bb5 100644
--- a/src/testbed/gnunet-service-testbed_barriers.c
+++ b/src/testbed/gnunet-service-testbed_barriers.c
@@ -109,6 +109,11 @@ struct WBarrier
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 @@ wbarrier_status_cb (void *cls,
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 @@ handle_barrier_init (void *cls,
}
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 @@ handle_barrier_status (void *cls,
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 @@ handle_barrier_status (void *cls,
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 */
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index a019d9b641..ae40948b3c 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -1310,7 +1310,13 @@ handle_barrier_status (void *cls,
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);
}