diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-02-24 15:57:13 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-02-24 15:57:13 +0000 |
commit | 3c30d9be2e4c02b9d7a94191ad050fd83a011e09 (patch) | |
tree | 0d9cd15c32433b56ef83dc08a9ec47bc250e5fed /src/dht | |
parent | 425613b68d5e8f66dd3462bf6b47c64b3534ee96 (diff) | |
download | gnunet-3c30d9be2e4c02b9d7a94191ad050fd83a011e09.tar.gz gnunet-3c30d9be2e4c02b9d7a94191ad050fd83a011e09.zip |
- Fixed crashes when ctrl-c testcases
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/test_dht_multipeer.c | 10 | ||||
-rw-r--r-- | src/dht/test_dht_topo.c | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c index 8aba2743d..b8da82a2d 100644 --- a/src/dht/test_dht_multipeer.c +++ b/src/dht/test_dht_multipeer.c | |||
@@ -664,7 +664,10 @@ put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
664 | 664 | ||
665 | outstanding_puts--; | 665 | outstanding_puts--; |
666 | puts_completed++; | 666 | puts_completed++; |
667 | GNUNET_SCHEDULER_cancel (test_put->task); | 667 | if (GNUNET_SCHEDULER_NO_TASK != test_put->task) |
668 | { | ||
669 | GNUNET_SCHEDULER_cancel (test_put->task); | ||
670 | } | ||
668 | test_put->task = GNUNET_SCHEDULER_add_now (&put_disconnect_task, test_put); | 671 | test_put->task = GNUNET_SCHEDULER_add_now (&put_disconnect_task, test_put); |
669 | if (puts_completed != num_peers * num_peers) | 672 | if (puts_completed != num_peers * num_peers) |
670 | return; | 673 | return; |
@@ -716,6 +719,11 @@ run_dht_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
716 | unsigned long long i; | 719 | unsigned long long i; |
717 | struct TestPutContext *test_put; | 720 | struct TestPutContext *test_put; |
718 | 721 | ||
722 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | ||
723 | { | ||
724 | ok = 1; | ||
725 | return; | ||
726 | } | ||
719 | #if PATH_TRACKING | 727 | #if PATH_TRACKING |
720 | route_option = | 728 | route_option = |
721 | GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; | 729 | GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; |
diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c index a4f150ef5..38d9bffad 100644 --- a/src/dht/test_dht_topo.c +++ b/src/dht/test_dht_topo.c | |||
@@ -155,6 +155,7 @@ shutdown_callback (void *cls, const char *emsg) | |||
155 | "test: All peers successfully shut down!\n"); | 155 | "test: All peers successfully shut down!\n"); |
156 | #endif | 156 | #endif |
157 | } | 157 | } |
158 | GNUNET_CONFIGURATION_destroy (testing_cfg); | ||
158 | } | 159 | } |
159 | 160 | ||
160 | 161 | ||
@@ -174,7 +175,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
174 | if (data_file != NULL) | 175 | if (data_file != NULL) |
175 | GNUNET_DISK_file_close (data_file); | 176 | GNUNET_DISK_file_close (data_file); |
176 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 177 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
177 | GNUNET_CONFIGURATION_destroy (testing_cfg); | ||
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||