aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_reliability.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-09-13 08:15:04 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-09-13 08:15:04 +0000
commit983b7b09169634e585949bf4d5e09336cbf76afc (patch)
tree53857686a346aa2befb0ecfb884ac995459e5647 /src/transport/test_transport_api_reliability.c
parent2e2d452622803bd082c5e9d197e8a6e3c84e4d93 (diff)
downloadgnunet-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_reliability.c')
-rw-r--r--src/transport/test_transport_api_reliability.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 7b7d9eac4..18971a986 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -45,9 +45,15 @@
45#define START_ARM GNUNET_YES 45#define START_ARM GNUNET_YES
46 46
47/** 47/**
48 * Testcase timeout
49 */
50#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
51
52/**
48 * How long until we give up on transmitting the message? 53 * How long until we give up on transmitting the message?
49 */ 54 */
50#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 900) 55#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
56
51 57
52static char *test_source; 58static char *test_source;
53 59
@@ -251,13 +257,18 @@ notify_ready (void *cls, size_t size, void *buf)
251 unsigned int s; 257 unsigned int s;
252 unsigned int ret; 258 unsigned int ret;
253 259
260 th = NULL;
254 if (buf == NULL) 261 if (buf == NULL)
255 { 262 {
256 GNUNET_break (0); 263 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
264 "Timeout occurred while waiting for transmit_ready\n");
265 if (GNUNET_SCHEDULER_NO_TASK != die_task)
266 GNUNET_SCHEDULER_cancel (die_task);
267 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
257 ok = 42; 268 ok = 42;
258 return 0; 269 return 0;
259 } 270 }
260 th = NULL; 271
261 ret = 0; 272 ret = 0;
262 s = get_size (n); 273 s = get_size (n);
263 GNUNET_assert (size >= s); 274 GNUNET_assert (size >= s);
@@ -290,8 +301,8 @@ notify_ready (void *cls, size_t size, void *buf)
290 { 301 {
291 if (th == NULL) 302 if (th == NULL)
292 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, 303 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0,
293 TIMEOUT, &notify_ready, 304 TIMEOUT_TRANSMIT,
294 NULL); 305 &notify_ready, NULL);
295 msg_scheduled = n; 306 msg_scheduled = n;
296 } 307 }
297 if (n % 5000 == 0) 308 if (n % 5000 == 0)
@@ -348,7 +359,8 @@ sendtask ()
348{ 359{
349 start_time = GNUNET_TIME_absolute_get (); 360 start_time = GNUNET_TIME_absolute_get ();
350 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, 361 th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0,
351 TIMEOUT, &notify_ready, NULL); 362 TIMEOUT_TRANSMIT, &notify_ready,
363 NULL);
352} 364}
353 365
354static void 366static void