From 59f3b502b217de8f28b4071eac6928cadcad895b Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Mon, 20 Sep 2010 09:56:52 +0000 Subject: [PATCH] daemons_vary fix --- src/testing/testing_group.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 6f100cbdd..84260924b 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -4135,19 +4135,23 @@ GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_NotifyCompletion cb, void *cb_cls) { + struct ShutdownContext *shutdown_ctx; + struct ChurnRestartContext *startup_ctx; struct ChurnContext *churn_ctx; if (GNUNET_NO == desired_status) { if (NULL != pg->peers[offset].daemon) { + shutdown_ctx = GNUNET_malloc(sizeof(struct ShutdownContext)); churn_ctx = GNUNET_malloc(sizeof(struct ChurnContext)); churn_ctx->num_to_start = 0; churn_ctx->num_to_stop = 1; churn_ctx->cb = cb; - churn_ctx->cb_cls = cb_cls; + churn_ctx->cb_cls = cb_cls; + shutdown_ctx->cb_cls = churn_ctx; GNUNET_TESTING_daemon_stop(pg->peers[offset].daemon, - timeout, &churn_stop_callback, churn_ctx, + timeout, &churn_stop_callback, shutdown_ctx, GNUNET_NO, GNUNET_YES); } } @@ -4155,13 +4159,15 @@ GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, { if (NULL == pg->peers[offset].daemon) { + startup_ctx = GNUNET_malloc(sizeof(struct ChurnRestartContext)); churn_ctx = GNUNET_malloc(sizeof(struct ChurnContext)); churn_ctx->num_to_start = 1; churn_ctx->num_to_stop = 0; churn_ctx->cb = cb; churn_ctx->cb_cls = cb_cls; + startup_ctx->churn_ctx = churn_ctx; GNUNET_TESTING_daemon_start_stopped(pg->peers[offset].daemon, - timeout, &churn_start_callback, churn_ctx); + timeout, &churn_start_callback, startup_ctx); } } else -- 2.25.1