aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_topology.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-03-03 14:24:02 +0000
committerNathan S. Evans <evans@in.tum.de>2010-03-03 14:24:02 +0000
commitbbcad62c9148ba628a424a1c7986d6d9afd3bfa7 (patch)
tree50574df6ea04290f7c62ab7272936030773ef142 /src/testing/test_testing_topology.c
parentbdd57a279ff49221288b0b326c926d10224b4716 (diff)
downloadgnunet-bbcad62c9148ba628a424a1c7986d6d9afd3bfa7.tar.gz
gnunet-bbcad62c9148ba628a424a1c7986d6d9afd3bfa7.zip
bug fixes, feature additions
Diffstat (limited to 'src/testing/test_testing_topology.c')
-rw-r--r--src/testing/test_testing_topology.c66
1 files changed, 14 insertions, 52 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index a0438f7be..3ae3046ab 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -27,6 +27,8 @@
27 27
28#define VERBOSE GNUNET_NO 28#define VERBOSE GNUNET_NO
29 29
30
31#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
30/** 32/**
31 * How long until we give up on connecting the peers? 33 * How long until we give up on connecting the peers?
32 */ 34 */
@@ -175,9 +177,10 @@ process_mtype (void *cls,
175static void 177static void
176end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 178end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
177{ 179{
180 char *msg = cls;
178#if VERBOSE 181#if VERBOSE
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "End badly was called... stopping daemons.\n"); 183 "End badly was called (%s)... stopping daemons.\n", msg);
181#endif 184#endif
182 struct Connection *pos; 185 struct Connection *pos;
183 186
@@ -281,7 +284,7 @@ send_test_messages ()
281 struct TestMessageContext *pos; 284 struct TestMessageContext *pos;
282 struct Connection *conn_pos; 285 struct Connection *conn_pos;
283 die_task = GNUNET_SCHEDULER_add_delayed (sched, 286 die_task = GNUNET_SCHEDULER_add_delayed (sched,
284 TIMEOUT, 287 TEST_TIMEOUT,
285 &end_badly, "from send test messages"); 288 &end_badly, "from send test messages");
286 289
287 int count = 0; 290 int count = 0;
@@ -358,50 +361,6 @@ init_notify (void *cls,
358 GNUNET_SCHEDULER_cancel(sched, die_task); 361 GNUNET_SCHEDULER_cancel(sched, die_task);
359 GNUNET_SCHEDULER_add_now(sched, &send_test_messages, NULL); 362 GNUNET_SCHEDULER_add_now(sched, &send_test_messages, NULL);
360 } 363 }
361#if OLD
362 if (context->first_step_done == GNUNET_NO)
363 {
364 context->peer1handle = server;
365#if VERBOSE
366 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting core to peer 2\n");
367#endif
368 context->first_step_done = GNUNET_YES;
369 /* connect p2 */
370 GNUNET_CORE_connect (sched,
371 context->peer2->cfg,
372 TIMEOUT,
373 context,
374 &init_notify,
375 NULL,
376 NULL,
377 NULL,
378 NULL,
379 GNUNET_YES,
380 NULL, GNUNET_YES, handlers);
381
382 }
383 else
384 {
385 context->peer2handle = server;
386#if VERBOSE
387 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
388 "Asking core (1) for transmission to peer `%4s'\n",
389 GNUNET_i2s (&context->peer2->id));
390#endif
391 transmit_ready_scheduled++;
392 if (NULL == GNUNET_CORE_notify_transmit_ready (context->peer1->server,
393 0,
394 TIMEOUT,
395 &context->peer2->id,
396 sizeof (struct GNUNET_MessageHeader),
397 &transmit_ready, NULL))
398 {
399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
400 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
401 GNUNET_i2s (&context->peer2->id));
402 }
403 }
404#endif
405} 364}
406 365
407 366
@@ -413,7 +372,7 @@ setup_handlers ()
413 372
414 struct GNUNET_TESTING_Daemon *temp_daemon; 373 struct GNUNET_TESTING_Daemon *temp_daemon;
415 die_task = GNUNET_SCHEDULER_add_delayed (sched, 374 die_task = GNUNET_SCHEDULER_add_delayed (sched,
416 TIMEOUT, 375 TEST_TIMEOUT,
417 &end_badly, "from setup_handlers"); 376 &end_badly, "from setup_handlers");
418 377
419 378
@@ -479,7 +438,6 @@ topology_callback (void *cls,
479#if VERBOSE 438#if VERBOSE
480 else 439 else
481 { 440 {
482
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error %s\n", 441 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error %s\n",
484 first_daemon->shortname, 442 first_daemon->shortname,
485 second_daemon->shortname, emsg); 443 second_daemon->shortname, emsg);
@@ -495,7 +453,8 @@ topology_callback (void *cls,
495#endif 453#endif
496 454
497 GNUNET_SCHEDULER_cancel (sched, die_task); 455 GNUNET_SCHEDULER_cancel (sched, die_task);
498 die_task = GNUNET_SCHEDULER_add_now (sched, &setup_handlers, NULL); 456 /* die_task = GNUNET_SCHEDULER_add_now (sched, &setup_handlers, NULL); */
457 die_task = GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), &setup_handlers, NULL);
499 } 458 }
500 else 459 else
501 { 460 {
@@ -531,11 +490,11 @@ create_topology ()
531 if (expected_connections == GNUNET_SYSERR) 490 if (expected_connections == GNUNET_SYSERR)
532 { 491 {
533 die_task = GNUNET_SCHEDULER_add_now (sched, 492 die_task = GNUNET_SCHEDULER_add_now (sched,
534 &end_badly, NULL); 493 &end_badly, "from create topology (bad return)");
535 } 494 }
536 die_task = GNUNET_SCHEDULER_add_delayed (sched, 495 die_task = GNUNET_SCHEDULER_add_delayed (sched,
537 TIMEOUT, 496 TEST_TIMEOUT,
538 &end_badly, NULL); 497 &end_badly, "from create topology (timeout)");
539} 498}
540 499
541 500
@@ -632,6 +591,8 @@ check ()
632 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 591 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
633 argv, binary_name, "nohelp", 592 argv, binary_name, "nohelp",
634 options, &run, &ok); 593 options, &run, &ok);
594 GNUNET_free(binary_name);
595 GNUNET_free(config_file_name);
635 return ok; 596 return ok;
636} 597}
637 598
@@ -660,6 +621,7 @@ main (int argc, char *argv[])
660 ret = check (); 621 ret = check ();
661 sleep (1); 622 sleep (1);
662 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); 623 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing");
624 GNUNET_free(our_binary_name);
663 return ret; 625 return ret;
664} 626}
665 627