aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_api_reliability.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/test_core_api_reliability.c')
-rw-r--r--src/core/test_core_api_reliability.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 49fe8f9de..da67bb4d4 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -82,8 +82,6 @@ static struct PeerContext p1;
82 82
83static struct PeerContext p2; 83static struct PeerContext p2;
84 84
85static struct GNUNET_SCHEDULER_Handle *sched;
86
87static int ok; 85static int ok;
88 86
89#if VERBOSE 87#if VERBOSE
@@ -235,8 +233,8 @@ process_mtype (void *cls,
235 n, s, 233 n, s,
236 ntohs (message->size), 234 ntohs (message->size),
237 ntohl (hdr->num)); 235 ntohl (hdr->num));
238 GNUNET_SCHEDULER_cancel (sched, err_task); 236 GNUNET_SCHEDULER_cancel (err_task);
239 err_task = GNUNET_SCHEDULER_add_now (sched, &terminate_task_error, NULL); 237 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
240 return GNUNET_SYSERR; 238 return GNUNET_SYSERR;
241 } 239 }
242 if (ntohl (hdr->num) != n) 240 if (ntohl (hdr->num) != n)
@@ -246,8 +244,8 @@ process_mtype (void *cls,
246 n, s, 244 n, s,
247 ntohs (message->size), 245 ntohs (message->size),
248 ntohl (hdr->num)); 246 ntohl (hdr->num));
249 GNUNET_SCHEDULER_cancel (sched, err_task); 247 GNUNET_SCHEDULER_cancel (err_task);
250 err_task = GNUNET_SCHEDULER_add_now (sched, &terminate_task_error, NULL); 248 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
251 return GNUNET_SYSERR; 249 return GNUNET_SYSERR;
252 } 250 }
253#if VERBOSE 251#if VERBOSE
@@ -261,8 +259,8 @@ process_mtype (void *cls,
261 fprintf (stderr, "."); 259 fprintf (stderr, ".");
262 if (n == TOTAL_MSGS) 260 if (n == TOTAL_MSGS)
263 { 261 {
264 GNUNET_SCHEDULER_cancel (sched, err_task); 262 GNUNET_SCHEDULER_cancel (err_task);
265 GNUNET_SCHEDULER_add_now (sched, &terminate_task, NULL); 263 GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
266 } 264 }
267 else 265 else
268 { 266 {
@@ -334,10 +332,9 @@ transmit_ready (void *cls, size_t size, void *buf)
334 break; /* sometimes pack buffer full, sometimes not */ 332 break; /* sometimes pack buffer full, sometimes not */
335 } 333 }
336 while (size - ret >= s); 334 while (size - ret >= s);
337 GNUNET_SCHEDULER_cancel (sched, err_task); 335 GNUNET_SCHEDULER_cancel (err_task);
338 err_task = 336 err_task =
339 GNUNET_SCHEDULER_add_delayed (sched, 337 GNUNET_SCHEDULER_add_delayed (TIMEOUT,
340 TIMEOUT,
341 &terminate_task_error, 338 &terminate_task_error,
342 NULL); 339 NULL);
343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -368,8 +365,7 @@ init_notify (void *cls,
368 GNUNET_assert (ok == 2); 365 GNUNET_assert (ok == 2);
369 OKPP; 366 OKPP;
370 /* connect p2 */ 367 /* connect p2 */
371 GNUNET_CORE_connect (sched, 368 GNUNET_CORE_connect (p2.cfg,
372 p2.cfg,
373 TIMEOUT, 369 TIMEOUT,
374 &p2, 370 &p2,
375 &init_notify, 371 &init_notify,
@@ -389,8 +385,7 @@ init_notify (void *cls,
389 "Asking core (1) for transmission to peer `%4s'\n", 385 "Asking core (1) for transmission to peer `%4s'\n",
390 GNUNET_i2s (&p2.id)); 386 GNUNET_i2s (&p2.id));
391 err_task = 387 err_task =
392 GNUNET_SCHEDULER_add_delayed (sched, 388 GNUNET_SCHEDULER_add_delayed (TIMEOUT,
393 TIMEOUT,
394 &terminate_task_error, 389 &terminate_task_error,
395 NULL); 390 NULL);
396 start_time = GNUNET_TIME_absolute_get (); 391 start_time = GNUNET_TIME_absolute_get ();
@@ -444,7 +439,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
444 "-c", cfgname, NULL); 439 "-c", cfgname, NULL);
445#endif 440#endif
446 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 441 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
447 p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL); 442 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
448 GNUNET_assert (p->th != NULL); 443 GNUNET_assert (p->th != NULL);
449 GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); 444 GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
450} 445}
@@ -452,18 +447,15 @@ setup_peer (struct PeerContext *p, const char *cfgname)
452 447
453static void 448static void
454run (void *cls, 449run (void *cls,
455 struct GNUNET_SCHEDULER_Handle *s,
456 char *const *args, 450 char *const *args,
457 const char *cfgfile, 451 const char *cfgfile,
458 const struct GNUNET_CONFIGURATION_Handle *cfg) 452 const struct GNUNET_CONFIGURATION_Handle *cfg)
459{ 453{
460 GNUNET_assert (ok == 1); 454 GNUNET_assert (ok == 1);
461 OKPP; 455 OKPP;
462 sched = s;
463 setup_peer (&p1, "test_core_api_peer1.conf"); 456 setup_peer (&p1, "test_core_api_peer1.conf");
464 setup_peer (&p2, "test_core_api_peer2.conf"); 457 setup_peer (&p2, "test_core_api_peer2.conf");
465 GNUNET_CORE_connect (sched, 458 GNUNET_CORE_connect (p1.cfg,
466 p1.cfg,
467 TIMEOUT, 459 TIMEOUT,
468 &p1, 460 &p1,
469 &init_notify, 461 &init_notify,