diff options
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r-- | src/rps/test_rps.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 992b4dc54..0268ff438 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -264,6 +264,11 @@ static int ok; | |||
264 | /** | 264 | /** |
265 | * Identifier for the churn task that runs periodically | 265 | * Identifier for the churn task that runs periodically |
266 | */ | 266 | */ |
267 | static struct GNUNET_SCHEDULER_Task *shutdown_task; | ||
268 | |||
269 | /** | ||
270 | * Identifier for the churn task that runs periodically | ||
271 | */ | ||
267 | static struct GNUNET_SCHEDULER_Task *churn_task; | 272 | static struct GNUNET_SCHEDULER_Task *churn_task; |
268 | 273 | ||
269 | /** | 274 | /** |
@@ -782,7 +787,10 @@ default_reply_handle (void *cls, | |||
782 | 787 | ||
783 | if (0 == evaluate ()) | 788 | if (0 == evaluate ()) |
784 | { | 789 | { |
785 | GNUNET_SCHEDULER_shutdown (); | 790 | GNUNET_assert (NULL != shutdown_task); |
791 | GNUNET_SCHEDULER_cancel (shutdown_task); | ||
792 | shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL); | ||
793 | GNUNET_assert (NULL!= shutdown_task); | ||
786 | } | 794 | } |
787 | } | 795 | } |
788 | 796 | ||
@@ -1289,6 +1297,8 @@ churn (void *cls) | |||
1289 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1290 | "Churn function executing\n"); | 1298 | "Churn function executing\n"); |
1291 | 1299 | ||
1300 | churn_task = NULL; /* Should be invalid by now */ | ||
1301 | |||
1292 | /* Compute the probability for an online peer to go offline | 1302 | /* Compute the probability for an online peer to go offline |
1293 | * this round */ | 1303 | * this round */ |
1294 | portion_online = num_peers_online * 1.0 / num_peers; | 1304 | portion_online = num_peers_online * 1.0 / num_peers; |
@@ -1560,7 +1570,7 @@ run (void *cls, | |||
1560 | 1570 | ||
1561 | if (NULL != churn_task) | 1571 | if (NULL != churn_task) |
1562 | GNUNET_SCHEDULER_cancel (churn_task); | 1572 | GNUNET_SCHEDULER_cancel (churn_task); |
1563 | GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); | 1573 | shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); |
1564 | } | 1574 | } |
1565 | 1575 | ||
1566 | 1576 | ||