aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-06-20 09:05:51 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-06-20 09:05:51 +0000
commit1ad257905ce4a45bbe59b08ea52a3c3c6622da5d (patch)
tree5ebee625c994338f1fd592cae6c1d75af1909603
parent61a008c4e471cd5081d5c2871949da779246a868 (diff)
downloadgnunet-1ad257905ce4a45bbe59b08ea52a3c3c6622da5d.tar.gz
gnunet-1ad257905ce4a45bbe59b08ea52a3c3c6622da5d.zip
-rw-r--r--src/transport/test_transport_api.c9
-rw-r--r--src/transport/test_transport_api_reliability.c19
-rw-r--r--src/transport/test_transport_api_unreliability.c21
3 files changed, 33 insertions, 16 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index 966f66fff..3da87d2c8 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -102,7 +102,8 @@ static void
102end () 102end ()
103{ 103{
104 GNUNET_assert (ok == 6); 104 GNUNET_assert (ok == 6);
105 GNUNET_SCHEDULER_cancel (die_task); 105 if (GNUNET_SCHEDULER_NO_TASK != die_task)
106 GNUNET_SCHEDULER_cancel (die_task);
106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
107 "Disconnecting from transports!\n"); 108 "Disconnecting from transports!\n");
108 if (th != NULL) 109 if (th != NULL)
@@ -250,8 +251,10 @@ notify_connect (void *cls,
250 GNUNET_assert (ok >= 2); 251 GNUNET_assert (ok >= 2);
251 OKPP; 252 OKPP;
252 OKPP; 253 OKPP;
253 GNUNET_SCHEDULER_cancel (die_task); 254 if (GNUNET_SCHEDULER_NO_TASK != die_task)
254 GNUNET_SCHEDULER_cancel (tct); 255 GNUNET_SCHEDULER_cancel (die_task);
256 if (GNUNET_SCHEDULER_NO_TASK != tct)
257 GNUNET_SCHEDULER_cancel (tct);
255 tct = GNUNET_SCHEDULER_NO_TASK; 258 tct = GNUNET_SCHEDULER_NO_TASK;
256 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); 259 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2);
257 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); 260 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1);
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 3964b43ef..50a9cc80e 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -114,7 +114,8 @@ end ()
114 unsigned long long delta; 114 unsigned long long delta;
115 char *value_name; 115 char *value_name;
116 116
117 GNUNET_SCHEDULER_cancel (die_task); 117 if (die_task != GNUNET_SCHEDULER_NO_TASK)
118 GNUNET_SCHEDULER_cancel (die_task);
118 die_task = GNUNET_SCHEDULER_NO_TASK; 119 die_task = GNUNET_SCHEDULER_NO_TASK;
119#if VERBOSE 120#if VERBOSE
120 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); 121 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n");
@@ -227,7 +228,8 @@ notify_receive (void *cls,
227 n, s, 228 n, s,
228 ntohs (message->size), 229 ntohs (message->size),
229 ntohl (hdr->num)); 230 ntohl (hdr->num));
230 GNUNET_SCHEDULER_cancel (die_task); 231 if (die_task != GNUNET_SCHEDULER_NO_TASK)
232 GNUNET_SCHEDULER_cancel (die_task);
231 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 233 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
232 return; 234 return;
233 } 235 }
@@ -238,7 +240,8 @@ notify_receive (void *cls,
238 n, s, 240 n, s,
239 ntohs (message->size), 241 ntohs (message->size),
240 ntohl (hdr->num)); 242 ntohl (hdr->num));
241 GNUNET_SCHEDULER_cancel (die_task); 243 if (die_task != GNUNET_SCHEDULER_NO_TASK)
244 GNUNET_SCHEDULER_cancel (die_task);
242 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 245 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
243 return; 246 return;
244 } 247 }
@@ -250,7 +253,8 @@ notify_receive (void *cls,
250 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 253 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
251 "Expected message %u with bits %u, but body did not match\n", 254 "Expected message %u with bits %u, but body did not match\n",
252 n, (unsigned char) n); 255 n, (unsigned char) n);
253 GNUNET_SCHEDULER_cancel (die_task); 256 if (die_task != GNUNET_SCHEDULER_NO_TASK)
257 GNUNET_SCHEDULER_cancel (die_task);
254 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 258 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
255 return; 259 return;
256 } 260 }
@@ -267,7 +271,8 @@ notify_receive (void *cls,
267 if (0 == (n % (TOTAL_MSGS/100))) 271 if (0 == (n % (TOTAL_MSGS/100)))
268 { 272 {
269 fprintf (stderr, "."); 273 fprintf (stderr, ".");
270 GNUNET_SCHEDULER_cancel (die_task); 274 if (die_task != GNUNET_SCHEDULER_NO_TASK)
275 GNUNET_SCHEDULER_cancel (die_task);
271 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 276 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
272 &end_badly, 277 &end_badly,
273 NULL); 278 NULL);
@@ -420,7 +425,9 @@ notify_connect (void *cls,
420 } 425 }
421 if (2 == connected) 426 if (2 == connected)
422 { 427 {
423 GNUNET_SCHEDULER_cancel (die_task); 428 if (die_task != GNUNET_SCHEDULER_NO_TASK)
429 GNUNET_SCHEDULER_cancel (die_task);
430 if (tct != GNUNET_SCHEDULER_NO_TASK)
424 GNUNET_SCHEDULER_cancel (tct); 431 GNUNET_SCHEDULER_cancel (tct);
425 tct = GNUNET_SCHEDULER_NO_TASK; 432 tct = GNUNET_SCHEDULER_NO_TASK;
426 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); 433 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2);
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 90a53c2b8..0cfc036de 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -164,7 +164,8 @@ end ()
164 } 164 }
165 } 165 }
166 166
167 GNUNET_SCHEDULER_cancel (die_task); 167 if (GNUNET_SCHEDULER_NO_TASK != tct)
168 GNUNET_SCHEDULER_cancel (die_task);
168 die_task = GNUNET_SCHEDULER_NO_TASK; 169 die_task = GNUNET_SCHEDULER_NO_TASK;
169#if VERBOSE 170#if VERBOSE
170 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); 171 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n");
@@ -325,7 +326,8 @@ notify_receive (void *cls,
325 ntohl(hdr->num), s, 326 ntohl(hdr->num), s,
326 ntohs (message->size), 327 ntohs (message->size),
327 ntohl (hdr->num)); 328 ntohl (hdr->num));
328 GNUNET_SCHEDULER_cancel (die_task); 329 if (GNUNET_SCHEDULER_NO_TASK != die_task)
330 GNUNET_SCHEDULER_cancel (die_task);
329 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 331 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
330 return; 332 return;
331 } 333 }
@@ -338,7 +340,8 @@ notify_receive (void *cls,
338 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
339 "Expected message %u with bits %u, but body did not match\n", 341 "Expected message %u with bits %u, but body did not match\n",
340 ntohl(hdr->num), (unsigned char) n); 342 ntohl(hdr->num), (unsigned char) n);
341 GNUNET_SCHEDULER_cancel (die_task); 343 if (GNUNET_SCHEDULER_NO_TASK != die_task)
344 GNUNET_SCHEDULER_cancel (die_task);
342 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 345 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
343 return; 346 return;
344 } 347 }
@@ -356,7 +359,8 @@ notify_receive (void *cls,
356 if (0 == (n % (5000))) 359 if (0 == (n % (5000)))
357 { 360 {
358 fprintf (stderr, "."); 361 fprintf (stderr, ".");
359 GNUNET_SCHEDULER_cancel (die_task); 362 if (GNUNET_SCHEDULER_NO_TASK != die_task)
363 GNUNET_SCHEDULER_cancel (die_task);
360 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 364 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
361 &end_badly, 365 &end_badly,
362 NULL); 366 NULL);
@@ -425,7 +429,8 @@ notify_ready (void *cls, size_t size, void *buf)
425 else 429 else
426 { 430 {
427 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent!!\n"); 431 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent!!\n");
428 GNUNET_SCHEDULER_cancel(die_task); 432 if (GNUNET_SCHEDULER_NO_TASK != die_task)
433 GNUNET_SCHEDULER_cancel(die_task);
429 die_task = GNUNET_SCHEDULER_add_delayed (UNRELIABLE_TIMEOUT, &end_unreliably, NULL); 434 die_task = GNUNET_SCHEDULER_add_delayed (UNRELIABLE_TIMEOUT, &end_unreliably, NULL);
430 } 435 }
431 if (n % 5000 == 0) 436 if (n % 5000 == 0)
@@ -519,8 +524,10 @@ notify_connect (void *cls,
519 } 524 }
520 if (2 == connected) 525 if (2 == connected)
521 { 526 {
522 GNUNET_SCHEDULER_cancel (die_task); 527 if (GNUNET_SCHEDULER_NO_TASK != die_task)
523 GNUNET_SCHEDULER_cancel (tct); 528 GNUNET_SCHEDULER_cancel (die_task);
529 if (GNUNET_SCHEDULER_NO_TASK != die_task)
530 GNUNET_SCHEDULER_cancel (tct);
524 tct = GNUNET_SCHEDULER_NO_TASK; 531 tct = GNUNET_SCHEDULER_NO_TASK;
525 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); 532 GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2);
526 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); 533 GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1);