diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-02-24 16:48:35 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-02-24 16:48:35 +0000 |
commit | e16473d60a93bb412c45a51ec5e71c944ffdaefb (patch) | |
tree | ba749de0bdce9279c3b5e25ff4e6749c237da844 /src/dht/test_dht_multipeer.c | |
parent | 59abfa3ceafffc4d65965571cd9a574ac190d608 (diff) | |
download | gnunet-e16473d60a93bb412c45a51ec5e71c944ffdaefb.tar.gz gnunet-e16473d60a93bb412c45a51ec5e71c944ffdaefb.zip |
- Avoid calling daemons_stop with NULL, minor doxygen fixes
Diffstat (limited to 'src/dht/test_dht_multipeer.c')
-rw-r--r-- | src/dht/test_dht_multipeer.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c index 48946df75..5292a7068 100644 --- a/src/dht/test_dht_multipeer.c +++ b/src/dht/test_dht_multipeer.c | |||
@@ -207,6 +207,11 @@ static enum GNUNET_DHT_RouteOption route_option; | |||
207 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 207 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * Task handle to use to schedule test shutdown | ||
211 | */ | ||
212 | GNUNET_SCHEDULER_TaskIdentifier shutdown_task; | ||
213 | |||
214 | /** | ||
210 | * Global return value (0 for success, anything else for failure) | 215 | * Global return value (0 for success, anything else for failure) |
211 | */ | 216 | */ |
212 | static int ok; | 217 | static int ok; |
@@ -224,14 +229,27 @@ shutdown_callback (void *cls, const char *emsg) | |||
224 | if (ok == 0) | 229 | if (ok == 0) |
225 | ok = 2; | 230 | ok = 2; |
226 | } | 231 | } |
227 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Shutdown callback completed.\n"); | 232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown callback completed.\n"); |
228 | } | 233 | } |
229 | 234 | ||
230 | static void | 235 | static void |
231 | do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 236 | do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
232 | { | 237 | { |
233 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Shutdown requested.\n"); | 238 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) == 0) |
234 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 239 | { |
240 | if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) | ||
241 | { | ||
242 | GNUNET_SCHEDULER_cancel(shutdown_task); | ||
243 | shutdown_task = GNUNET_SCHEDULER_NO_TASK; | ||
244 | } | ||
245 | } | ||
246 | else | ||
247 | { | ||
248 | shutdown_task = GNUNET_SCHEDULER_NO_TASK ; | ||
249 | } | ||
250 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown requested.\n"); | ||
251 | if (NULL != pg) | ||
252 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | ||
235 | pg = NULL; | 253 | pg = NULL; |
236 | } | 254 | } |
237 | 255 | ||
@@ -790,8 +808,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
790 | pg = GNUNET_TESTING_peergroup_start (cfg, num_peers, TIMEOUT, NULL, | 808 | pg = GNUNET_TESTING_peergroup_start (cfg, num_peers, TIMEOUT, NULL, |
791 | &startup_done, NULL, NULL); | 809 | &startup_done, NULL, NULL); |
792 | GNUNET_assert (NULL != pg); | 810 | GNUNET_assert (NULL != pg); |
793 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, | 811 | shutdown_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, |
794 | &do_stop, NULL); | 812 | &do_stop, NULL); |
795 | } | 813 | } |
796 | 814 | ||
797 | 815 | ||