aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-01-07 22:07:31 +0100
committerJulius Bünger <buenger@mytum.de>2018-01-07 22:33:08 +0100
commitc82abbd7168ca7db1ea2ef7c79f71e8a25fa32ce (patch)
tree3fc5b4287809ef4e59e7b4796bac2bf3eee13e20 /src/rps
parent92b5bc1b168adda55e192f5b5faba8a13874f38b (diff)
downloadgnunet-c82abbd7168ca7db1ea2ef7c79f71e8a25fa32ce.tar.gz
gnunet-c82abbd7168ca7db1ea2ef7c79f71e8a25fa32ce.zip
rps tests: proper shutdown
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/test_rps.c14
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 */
267static struct GNUNET_SCHEDULER_Task *shutdown_task;
268
269/**
270 * Identifier for the churn task that runs periodically
271 */
267static struct GNUNET_SCHEDULER_Task *churn_task; 272static 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