diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-01-15 13:45:50 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-01-15 13:45:50 +0000 |
commit | 5b9b90feb342a0a6fa5bb757d705d08054f68483 (patch) | |
tree | 5d84bc0c4ae795de53dd9ff89d309c15257cf9fb /src/cadet | |
parent | 65c31ec5191b319dc84d5f19b180657430424da1 (diff) | |
download | gnunet-5b9b90feb342a0a6fa5bb757d705d08054f68483.tar.gz gnunet-5b9b90feb342a0a6fa5bb757d705d08054f68483.zip |
- fix crashes, zombie controller on ^C
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/test_cadet.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index efa99ed75..aaf9c4f0c 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -33,7 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * How namy messages to send | 34 | * How namy messages to send |
35 | */ | 35 | */ |
36 | #define TOTAL_PACKETS 20 | 36 | #define TOTAL_PACKETS 2000 |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * How long until we give up on connecting the peers? | 39 | * How long until we give up on connecting the peers? |
@@ -265,7 +265,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
265 | * @param tc Task Context. | 265 | * @param tc Task Context. |
266 | */ | 266 | */ |
267 | static void | 267 | static void |
268 | disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 268 | disconnect_cadet_peers (void *cls, |
269 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
269 | { | 270 | { |
270 | long line = (long) cls; | 271 | long line = (long) cls; |
271 | unsigned int i; | 272 | unsigned int i; |
@@ -275,7 +276,7 @@ disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
275 | "disconnecting cadet peers due to SHUTDOWN! called from %ld\n", | 276 | "disconnecting cadet peers due to SHUTDOWN! called from %ld\n", |
276 | line); | 277 | line); |
277 | else | 278 | else |
278 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 279 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
279 | "disconnecting cadet service of peers, called from line %ld\n", | 280 | "disconnecting cadet service of peers, called from line %ld\n", |
280 | line); | 281 | line); |
281 | disconnect_task = NULL; | 282 | disconnect_task = NULL; |
@@ -370,11 +371,18 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer, | |||
370 | static void | 371 | static void |
371 | gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 372 | gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
372 | { | 373 | { |
374 | disconnect_task = NULL; | ||
375 | |||
376 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics\n"); | ||
377 | |||
373 | if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) | 378 | if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) |
379 | { | ||
380 | disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, | ||
381 | (void *) __LINE__); | ||
374 | return; | 382 | return; |
383 | } | ||
384 | |||
375 | 385 | ||
376 | disconnect_task = NULL; | ||
377 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics\n"); | ||
378 | if (NULL != ch) | 386 | if (NULL != ch) |
379 | { | 387 | { |
380 | GNUNET_CADET_channel_destroy (ch); | 388 | GNUNET_CADET_channel_destroy (ch); |
@@ -430,10 +438,11 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
430 | struct GNUNET_CADET_Channel *channel; | 438 | struct GNUNET_CADET_Channel *channel; |
431 | long src; | 439 | long src; |
432 | 440 | ||
441 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n"); | ||
442 | |||
433 | if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) | 443 | if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) |
434 | return; | 444 | return; |
435 | 445 | ||
436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n"); | ||
437 | if (GNUNET_YES == test_backwards) | 446 | if (GNUNET_YES == test_backwards) |
438 | { | 447 | { |
439 | channel = incoming_ch; | 448 | channel = incoming_ch; |
@@ -444,6 +453,12 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
444 | channel = ch; | 453 | channel = ch; |
445 | src = 0; | 454 | src = 0; |
446 | } | 455 | } |
456 | |||
457 | if (NULL == channel) | ||
458 | { | ||
459 | GNUNET_break (0); | ||
460 | return; | ||
461 | } | ||
447 | th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO, | 462 | th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO, |
448 | GNUNET_TIME_UNIT_FOREVER_REL, | 463 | GNUNET_TIME_UNIT_FOREVER_REL, |
449 | size_payload + data_sent, | 464 | size_payload + data_sent, |