#endif
GNUNET_assert (daemon->phase == SP_GET_HELLO ||
daemon->phase == SP_START_DONE);
- daemon->cb = NULL;
+ daemon->cb = NULL; // FIXME: why??? (see fsm:SP_START_CORE, notify_daemon_started)
if (daemon->task != GNUNET_SCHEDULER_NO_TASK) /* Assertion here instead? */
GNUNET_SCHEDULER_cancel (daemon->task);
daemon->phase = SP_START_DONE;
}
-static void
-start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
* Notify of a peer being up and running. Scheduled as a task
* so that variables which may need to be set are set before
* the connect callback can set up new operations.
+ * FIXME: what variables?????? where from????
*
* @param cls the testing daemon
* @param tc task scheduler context
int bytes_read;
#if DEBUG_TESTING
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer FSM is in phase %u.\n", d->phase);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n",
+ GNUNET_i2s (&d->id), d->phase);
#endif
d->task = GNUNET_SCHEDULER_NO_TASK;
emsg);
}
+
+/**
+ * Calls GNUNET_TESTING_daemon_continue_startup to set the daemon's state
+ * from HOSTKEY_CREATED to TOPOLOGY_SETUP. Makes sure not to saturate a host
+ * with requests delaying them when needed.
+ *
+ * @param cls closure: internal context of the daemon.
+ * @param tc TaskContext
+ */
static void
internal_continue_startup (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %d total connections, which is our target number! Starting next phase of testing.\n",
- total_connections);
+ pg_start_ctx->total_connections);
#endif
#if TIMING
#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
- (num_peers - peers_left) + 1, num_peers);
+ (pg_start_ctx->total - pg_start_ctx->peers_left) + 1,
+ pg_start_ctx->total);
#endif
pg_start_ctx->peers_left--;
{
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "All %d daemons started, now connecting peers!\n", num_peers);
+ "All %d daemons started, now connecting peers!\n",
+ pg_start_ctx->total);
#endif
GNUNET_assert (pg_start_ctx->die_task != GNUNET_SCHEDULER_NO_TASK);
GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task);
pg_start_ctx->expected_connections = UINT_MAX;
+ // FIXME: why whould peers_left be != 0?? Or pg NULL?
if ((pg_start_ctx->pg != NULL) && (pg_start_ctx->peers_left == 0))
{
pg_start_ctx->connect_start_time = GNUNET_TIME_absolute_get ();
#if VERBOSE > 1
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Hostkey (%d/%d) created for peer `%s'\n", num_peers - peers_left,
- num_peers, GNUNET_i2s (id));
+ "Hostkey (%d/%d) created for peer `%s'\n",
+ pg_start_ctx->total - pg_start_ctx->peers_left,
+ pg_start_ctx->total, GNUNET_i2s (id));
#endif
pg_start_ctx->peers_left--;
if (GNUNET_YES == update_meter (pg_start_ctx->hostkey_meter))
{
GNUNET_SCHEDULER_cancel (pg_start_ctx->die_task);
+ GNUNET_free_non_null (pg_start_ctx->fail_reason);
/* Set up task in case topology creation doesn't finish
* within a reasonable amount of time */
- GNUNET_free_non_null (pg_start_ctx->fail_reason);
pg_start_ctx->fail_reason = GNUNET_strdup ("from create_topology");
pg_start_ctx->die_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining