aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2014-08-22 14:37:39 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2014-08-22 14:37:39 +0000
commit68e27c68530fcdcba06b6e44ab411aad62eda0ac (patch)
tree35bdeee9095861f9228920fa5766d391ce603507
parentd2fcf66a3f5b1b45b64ce039b5b604d157866e7f (diff)
downloadgnunet-68e27c68530fcdcba06b6e44ab411aad62eda0ac.tar.gz
gnunet-68e27c68530fcdcba06b6e44ab411aad62eda0ac.zip
Do not continue if we are going to shutdown.
-rw-r--r--src/dht/gnunet_dht_profiler.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index b95239f32..bc1ee86d8 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -349,7 +349,6 @@ struct Context **peer_contexts = NULL;
349 */ 349 */
350static int peers_started = 0; 350static int peers_started = 0;
351 351
352
353/** 352/**
354 * Should we do a PUT (mode = 0) or GET (mode = 1); 353 * Should we do a PUT (mode = 0) or GET (mode = 1);
355 */ 354 */
@@ -360,6 +359,12 @@ static enum
360 MODE_GET = 1 359 MODE_GET = 1
361} mode; 360} mode;
362 361
362
363/**
364 * Are we shutting down
365 */
366static int in_shutdown = 0;
367
363/** 368/**
364 * Task that collects successor statistics from all the peers. 369 * Task that collects successor statistics from all the peers.
365 * @param cls 370 * @param cls
@@ -381,6 +386,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
381 struct ActiveContext *ac; 386 struct ActiveContext *ac;
382 unsigned int cnt; 387 unsigned int cnt;
383 388
389 in_shutdown = GNUNET_YES;
384 if (NULL != a_ctx) 390 if (NULL != a_ctx)
385 { 391 {
386 for (cnt=0; cnt < num_peers; cnt++) 392 for (cnt=0; cnt < num_peers; cnt++)
@@ -786,6 +792,8 @@ dht_disconnect (void *cls, void *op_result)
786 n_dht--; 792 n_dht--;
787 if (0 != n_dht) 793 if (0 != n_dht)
788 return; 794 return;
795 if (GNUNET_YES == in_shutdown)
796 return;
789 switch (mode) 797 switch (mode)
790 { 798 {
791 case MODE_PUT: 799 case MODE_PUT:
@@ -815,6 +823,7 @@ start_profiling()
815 unsigned int i; 823 unsigned int i;
816 824
817 DEBUG("GNUNET_TESTBED_service_connect \n"); 825 DEBUG("GNUNET_TESTBED_service_connect \n");
826 GNUNET_break (GNUNET_YES != in_shutdown);
818 for(i = 0; i < n_active; i++) 827 for(i = 0; i < n_active; i++)
819 { 828 {
820 struct ActiveContext *ac = &a_ac[i]; 829 struct ActiveContext *ac = &a_ac[i];