diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-13 08:15:04 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-13 08:15:04 +0000 |
commit | 983b7b09169634e585949bf4d5e09336cbf76afc (patch) | |
tree | 53857686a346aa2befb0ecfb884ac995459e5647 /src/transport/test_transport_api_unreliability.c | |
parent | 2e2d452622803bd082c5e9d197e8a6e3c84e4d93 (diff) | |
download | gnunet-983b7b09169634e585949bf4d5e09336cbf76afc.tar.gz gnunet-983b7b09169634e585949bf4d5e09336cbf76afc.zip |
no hard fail in case out transmit_ready timeout instead shut peers correctly down
Diffstat (limited to 'src/transport/test_transport_api_unreliability.c')
-rw-r--r-- | src/transport/test_transport_api_unreliability.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index 13a765c72..aa84b8519 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c | |||
@@ -46,9 +46,14 @@ | |||
46 | #define START_ARM GNUNET_YES | 46 | #define START_ARM GNUNET_YES |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Testcase timeout | ||
50 | */ | ||
51 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
52 | |||
53 | /** | ||
49 | * How long until we give up on transmitting the message? | 54 | * How long until we give up on transmitting the message? |
50 | */ | 55 | */ |
51 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 900) | 56 | #define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
52 | 57 | ||
53 | static char *test_source; | 58 | static char *test_source; |
54 | 59 | ||
@@ -315,7 +320,11 @@ notify_ready (void *cls, size_t size, void *buf) | |||
315 | 320 | ||
316 | if (buf == NULL) | 321 | if (buf == NULL) |
317 | { | 322 | { |
318 | GNUNET_break (0); | 323 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
324 | "Timeout occurred while waiting for transmit_ready\n"); | ||
325 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | ||
326 | GNUNET_SCHEDULER_cancel (die_task); | ||
327 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | ||
319 | ok = 42; | 328 | ok = 42; |
320 | return 0; | 329 | return 0; |
321 | } | 330 | } |
@@ -350,7 +359,8 @@ notify_ready (void *cls, size_t size, void *buf) | |||
350 | while (size - ret >= s); | 359 | while (size - ret >= s); |
351 | if (n < TOTAL_MSGS) | 360 | if (n < TOTAL_MSGS) |
352 | { | 361 | { |
353 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, TIMEOUT, | 362 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, |
363 | TIMEOUT_TRANSMIT, | ||
354 | ¬ify_ready, NULL); | 364 | ¬ify_ready, NULL); |
355 | msg_scheduled = n; | 365 | msg_scheduled = n; |
356 | } | 366 | } |
@@ -412,7 +422,8 @@ sendtask () | |||
412 | { | 422 | { |
413 | start_time = GNUNET_TIME_absolute_get (); | 423 | start_time = GNUNET_TIME_absolute_get (); |
414 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, | 424 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, |
415 | TIMEOUT, ¬ify_ready, NULL); | 425 | TIMEOUT_TRANSMIT, ¬ify_ready, |
426 | NULL); | ||
416 | } | 427 | } |
417 | 428 | ||
418 | static void | 429 | static void |