gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18056 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r18056 - gnunet/src/testing
Date: Tue, 8 Nov 2011 22:27:30 +0100

Author: bartpolot
Date: 2011-11-08 22:27:30 +0100 (Tue, 08 Nov 2011)
New Revision: 18056

Modified:
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_group.c
   gnunet/src/testing/testing_peergroup.c
Log:
Added comments, fixed debug code, added doxygen

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2011-11-08 19:37:32 UTC (rev 18055)
+++ gnunet/src/testing/testing.c        2011-11-08 21:27:30 UTC (rev 18056)
@@ -106,7 +106,7 @@
 #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);
 
@@ -148,13 +148,12 @@
   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
@@ -189,7 +188,8 @@
   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;

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-11-08 19:37:32 UTC (rev 18055)
+++ gnunet/src/testing/testing_group.c  2011-11-08 21:27:30 UTC (rev 18056)
@@ -5543,6 +5543,15 @@
                                 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)

Modified: gnunet/src/testing/testing_peergroup.c
===================================================================
--- gnunet/src/testing/testing_peergroup.c      2011-11-08 19:37:32 UTC (rev 
18055)
+++ gnunet/src/testing/testing_peergroup.c      2011-11-08 21:27:30 UTC (rev 
18056)
@@ -416,7 +416,7 @@
 #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
@@ -472,7 +472,8 @@
 
 #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--;
@@ -481,12 +482,14 @@
   {
 #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 ();
@@ -549,17 +552,18 @@
 
 #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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]