diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-22 15:09:12 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-22 15:09:12 +0000 |
commit | f17eb03bb194e1d6ff626b1cb5ea6757aa5245d1 (patch) | |
tree | ca318bc115ef16c22f34f252b67933bd0858dd0d /src/testbed | |
parent | 9ae60ce30ada99a913b4349a4bfff27d09d41287 (diff) | |
download | gnunet-f17eb03bb194e1d6ff626b1cb5ea6757aa5245d1.tar.gz gnunet-f17eb03bb194e1d6ff626b1cb5ea6757aa5245d1.zip |
allow single host deployments
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index c646add7a..36d04601f 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -415,6 +415,34 @@ print_overlay_links_summary () | |||
415 | 415 | ||
416 | 416 | ||
417 | /** | 417 | /** |
418 | * Function to start peers | ||
419 | */ | ||
420 | static void | ||
421 | start_peers () | ||
422 | { | ||
423 | struct DLLOperation *dll_op; | ||
424 | unsigned int peer_cnt; | ||
425 | |||
426 | state = STATE_PEERS_CREATING; | ||
427 | prof_start_time = GNUNET_TIME_absolute_get (); | ||
428 | peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) | ||
429 | * num_peers); | ||
430 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) | ||
431 | { | ||
432 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | ||
433 | dll_op->cls = &peers[peer_cnt]; | ||
434 | dll_op->op = GNUNET_TESTBED_peer_create (mc, | ||
435 | hosts | ||
436 | [peer_cnt % num_hosts], | ||
437 | cfg, | ||
438 | &peer_create_cb, | ||
439 | dll_op); | ||
440 | GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | |||
445 | /** | ||
418 | * Controller event callback | 446 | * Controller event callback |
419 | * | 447 | * |
420 | * @param cls NULL | 448 | * @param cls NULL |
@@ -435,7 +463,6 @@ controller_event_cb (void *cls, | |||
435 | case GNUNET_TESTBED_ET_OPERATION_FINISHED: | 463 | case GNUNET_TESTBED_ET_OPERATION_FINISHED: |
436 | { | 464 | { |
437 | static unsigned int slaves_started; | 465 | static unsigned int slaves_started; |
438 | unsigned int peer_cnt; | ||
439 | 466 | ||
440 | dll_op = event->details.operation_finished.op_cls; | 467 | dll_op = event->details.operation_finished.op_cls; |
441 | GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); | 468 | GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); |
@@ -456,22 +483,7 @@ controller_event_cb (void *cls, | |||
456 | { | 483 | { |
457 | printf ("%u controllers started successfully\n", num_hosts); | 484 | printf ("%u controllers started successfully\n", num_hosts); |
458 | fflush (stdout); | 485 | fflush (stdout); |
459 | state = STATE_PEERS_CREATING; | 486 | start_peers (); |
460 | prof_start_time = GNUNET_TIME_absolute_get (); | ||
461 | peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) | ||
462 | * num_peers); | ||
463 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) | ||
464 | { | ||
465 | dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); | ||
466 | dll_op->cls = &peers[peer_cnt]; | ||
467 | dll_op->op = GNUNET_TESTBED_peer_create (mc, | ||
468 | hosts | ||
469 | [peer_cnt % num_hosts], | ||
470 | cfg, | ||
471 | &peer_create_cb, | ||
472 | dll_op); | ||
473 | GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op); | ||
474 | } | ||
475 | } | 487 | } |
476 | } | 488 | } |
477 | break; | 489 | break; |
@@ -643,7 +655,10 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat | |||
643 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); | 655 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); |
644 | return; | 656 | return; |
645 | } | 657 | } |
646 | register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, NULL); | 658 | if (num_hosts > 1) |
659 | register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, NULL); | ||
660 | else | ||
661 | start_peers (); | ||
647 | abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 662 | abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
648 | &do_abort, NULL); | 663 | &do_abort, NULL); |
649 | } | 664 | } |