aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-11-08 21:27:30 +0000
committerBart Polot <bart@net.in.tum.de>2011-11-08 21:27:30 +0000
commit0799af8eedff5c9e42b00dc8bd7baee78baa61a7 (patch)
treeffe0b518b53c52131b0887db39775a4d1d4baa1f /src
parentea3ff01740cdfd4505503bcff9f5d889ce1b4545 (diff)
downloadgnunet-0799af8eedff5c9e42b00dc8bd7baee78baa61a7.tar.gz
gnunet-0799af8eedff5c9e42b00dc8bd7baee78baa61a7.zip
Added comments, fixed debug code, added doxygen
Diffstat (limited to 'src')
-rw-r--r--src/testing/testing.c8
-rw-r--r--src/testing/testing_group.c9
-rw-r--r--src/testing/testing_peergroup.c16
3 files changed, 23 insertions, 10 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index b778b7d03..175888621 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -106,7 +106,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
106#endif 106#endif
107 GNUNET_assert (daemon->phase == SP_GET_HELLO || 107 GNUNET_assert (daemon->phase == SP_GET_HELLO ||
108 daemon->phase == SP_START_DONE); 108 daemon->phase == SP_START_DONE);
109 daemon->cb = NULL; 109 daemon->cb = NULL; // FIXME: why??? (see fsm:SP_START_CORE, notify_daemon_started)
110 if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */ 110 if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */
111 GNUNET_SCHEDULER_cancel (daemon->task); 111 GNUNET_SCHEDULER_cancel (daemon->task);
112 112
@@ -148,13 +148,12 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
148 daemon->phase = SP_START_DONE; 148 daemon->phase = SP_START_DONE;
149} 149}
150 150
151static void
152start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
153 151
154/** 152/**
155 * Notify of a peer being up and running. Scheduled as a task 153 * Notify of a peer being up and running. Scheduled as a task
156 * so that variables which may need to be set are set before 154 * so that variables which may need to be set are set before
157 * the connect callback can set up new operations. 155 * the connect callback can set up new operations.
156 * FIXME: what variables?????? where from????
158 * 157 *
159 * @param cls the testing daemon 158 * @param cls the testing daemon
160 * @param tc task scheduler context 159 * @param tc task scheduler context
@@ -189,7 +188,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
189 int bytes_read; 188 int bytes_read;
190 189
191#if DEBUG_TESTING 190#if DEBUG_TESTING
192 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer FSM is in phase %u.\n", d->phase); 191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n",
192 GNUNET_i2s (&d->id), d->phase);
193#endif 193#endif
194 194
195 d->task = GNUNET_SCHEDULER_NO_TASK; 195 d->task = GNUNET_SCHEDULER_NO_TASK;
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 171cf1c48..db763d22a 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -5543,6 +5543,15 @@ internal_startup_callback (void *cls, const struct GNUNET_PeerIdentity *id,
5543 emsg); 5543 emsg);
5544} 5544}
5545 5545
5546
5547/**
5548 * Calls GNUNET_TESTING_daemon_continue_startup to set the daemon's state
5549 * from HOSTKEY_CREATED to TOPOLOGY_SETUP. Makes sure not to saturate a host
5550 * with requests delaying them when needed.
5551 *
5552 * @param cls closure: internal context of the daemon.
5553 * @param tc TaskContext
5554 */
5546static void 5555static void
5547internal_continue_startup (void *cls, 5556internal_continue_startup (void *cls,
5548 const struct GNUNET_SCHEDULER_TaskContext *tc) 5557 const struct GNUNET_SCHEDULER_TaskContext *tc)
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c
index a46e1bfb2..d3290a36c 100644
--- a/src/testing/testing_peergroup.c
+++ b/src/testing/testing_peergroup.c
@@ -416,7 +416,7 @@ internal_topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
416#if VERBOSE 416#if VERBOSE
417 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 417 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
418 "Created %d total connections, which is our target number! Starting next phase of testing.\n", 418 "Created %d total connections, which is our target number! Starting next phase of testing.\n",
419 total_connections); 419 pg_start_ctx->total_connections);
420#endif 420#endif
421 421
422#if TIMING 422#if TIMING
@@ -472,7 +472,8 @@ internal_peers_started_callback (void *cls,
472 472
473#if VERBOSE > 1 473#if VERBOSE > 1
474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", 474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
475 (num_peers - peers_left) + 1, num_peers); 475 (pg_start_ctx->total - pg_start_ctx->peers_left) + 1,
476 pg_start_ctx->total);
476#endif 477#endif
477 478
478 pg_start_ctx->peers_left--; 479 pg_start_ctx->peers_left--;
@@ -481,12 +482,14 @@ internal_peers_started_callback (void *cls,
481 { 482 {
482#if VERBOSE 483#if VERBOSE
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 "All %d daemons started, now connecting peers!\n", num_peers); 485 "All %d daemons started, now connecting peers!\n",
486 pg_start_ctx->total);
485#endif 487#endif
486 GNUNET_assert (pg_start_ctx->die_task != GNUNET_SCHEDULER_NO_TASK); 488 GNUNET_assert (pg_start_ctx->die_task != GNUNET_SCHEDULER_NO_TASK);
487 GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task); 489 GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task);
488 490
489 pg_start_ctx->expected_connections = UINT_MAX; 491 pg_start_ctx->expected_connections = UINT_MAX;
492 // FIXME: why whould peers_left be != 0?? Or pg NULL?
490 if ((pg_start_ctx->pg != NULL) && (pg_start_ctx->peers_left == 0)) 493 if ((pg_start_ctx->pg != NULL) && (pg_start_ctx->peers_left == 0))
491 { 494 {
492 pg_start_ctx->connect_start_time = GNUNET_TIME_absolute_get (); 495 pg_start_ctx->connect_start_time = GNUNET_TIME_absolute_get ();
@@ -549,17 +552,18 @@ internal_hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
549 552
550#if VERBOSE > 1 553#if VERBOSE > 1
551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 554 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
552 "Hostkey (%d/%d) created for peer `%s'\n", num_peers - peers_left, 555 "Hostkey (%d/%d) created for peer `%s'\n",
553 num_peers, GNUNET_i2s (id)); 556 pg_start_ctx->total - pg_start_ctx->peers_left,
557 pg_start_ctx->total, GNUNET_i2s (id));
554#endif 558#endif
555 559
556 pg_start_ctx->peers_left--; 560 pg_start_ctx->peers_left--;
557 if (GNUNET_YES == update_meter (pg_start_ctx->hostkey_meter)) 561 if (GNUNET_YES == update_meter (pg_start_ctx->hostkey_meter))
558 { 562 {
559 GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task); 563 GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task);
564 GNUNET_free_non_null (pg_start_ctx->fail_reason);
560 /* Set up task in case topology creation doesn't finish 565 /* Set up task in case topology creation doesn't finish
561 * within a reasonable amount of time */ 566 * within a reasonable amount of time */
562 GNUNET_free_non_null (pg_start_ctx->fail_reason);
563 pg_start_ctx->fail_reason = GNUNET_strdup ("from create_topology"); 567 pg_start_ctx->fail_reason = GNUNET_strdup ("from create_topology");
564 pg_start_ctx->die_task = 568 pg_start_ctx->die_task =
565 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining 569 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining