- Remove printf, use GNUNET_log INFO
[oweals/gnunet.git] / src / nse / gnunet-nse-profiler.c
index 7bab5121c54eb67899d1adf6d3f77550c2db72a2..850817bdd6b8042a4bec12a59d86af818f38eed9 100644 (file)
@@ -27,7 +27,6 @@
  *
  * TODO:
  * - need to enable user to specify topology options
- * - need minor fix with "***"-host argument change in TESTBED (TBD there)
  * - need to check for leaks (especially FD leaks)
  * - need to TEST
  */
@@ -232,7 +231,7 @@ static char *topology_file;
 /**
  * List of hosts we use for the testbed.
  */
-static struct GNUNET_TESTBED_Host *hosts;
+static struct GNUNET_TESTBED_Host **hosts;
 
 /**
  * Size of the 'hosts' array.
@@ -249,10 +248,10 @@ static struct GNUNET_TESTBED_Controller *controller;
  */
 static struct GNUNET_TESTBED_ControllerProc *copro;
 
-/**
- * Testbed handle.
- */
-static struct GNUNET_TESTBED_Testbed *testbed;
+/* /\** */
+/*  * Testbed handle. */
+/*  *\/ */
+/* static struct GNUNET_TESTBED_Testbed *testbed; */
 
 
 /**
@@ -289,17 +288,20 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");    
   close_monitor_connections ();
-  if (NULL != testbed)
-    GNUNET_TESTBED_destroy (testbed);
+  /* if (NULL != testbed) */
+  /*   GNUNET_TESTBED_destroy (testbed); */
   if (NULL != controller)
     GNUNET_TESTBED_controller_disconnect (controller);
   if (NULL != copro)
       GNUNET_TESTBED_controller_stop (copro);
-  while (0 > num_hosts)
+  while (0 < num_hosts)
     GNUNET_TESTBED_host_destroy (hosts[--num_hosts]);
   // FIXME: what about closing other files!?
   if (NULL != data_file)
     GNUNET_DISK_file_close (data_file);
+  if (NULL != testing_cfg)
+    GNUNET_CONFIGURATION_destroy (testing_cfg);
+  testing_cfg = NULL;
 }
 
 
@@ -558,9 +560,6 @@ nse_disconnect_adapter (void *cls,
 /**
  * Task run to connect to the NSE and statistics services to a subset of
  * all of the running peers.
- *
- * @param cls handle the peer
- * @param tc ignored
  */
 static void
 connect_nse_service ()
@@ -618,8 +617,8 @@ next_round (void *cls,
  * last round, terminates the run.
  *
  * @param cls struct StatsContext
- * @param success GNUNET_OK if statistics were
- *        successfully obtained, GNUNET_SYSERR if not.
+ * @param op operation handle
+ * @param emsg error message, NULL on success
  */
 static void
 stats_finished_callback (void *cls,
@@ -840,7 +839,7 @@ next_round (void *cls,
 
   /* start peers if we have too few */
   for (i=peers_running;i<num_peers_in_round[current_round];i++)
-    GNUNET_TESTBED_peer_start (daemons[i], NULL, NULL);
+    GNUNET_TESTBED_peer_start (NULL, daemons[i], NULL, NULL);
 
   /* stop peers if we have too many */
   for (i=num_peers_in_round[current_round];i<peers_running;i++)
@@ -873,8 +872,10 @@ master_controller_cb (void *cls,
       break;
     case GNUNET_TESTBED_ET_CONNECT:
       total_connections++;
+      break;
     case GNUNET_TESTBED_ET_DISCONNECT:
       total_connections--;
+      break;
     default:
       break;
     }
@@ -893,6 +894,7 @@ controller_start_cb (void *cls,
       return;
     }
   num_hosts = GNUNET_TESTBED_hosts_load_from_file (hosts_file,
+                                                   testing_cfg,
                                                   &hosts);
   if (0 == num_hosts)
     {
@@ -905,12 +907,13 @@ controller_start_cb (void *cls,
                                               NULL, 
                                               0 /* mask */,
                                               &master_controller_cb, NULL);
-  testbed = GNUNET_TESTBED_create (controller,
-                                  num_hosts, hosts, 
-                                  num_peers,
-                                  cfg,
-                                  0 /* FIXME: topology */,
-                                  NULL /* FIXME: topology options */);
+
+  /* testbed = GNUNET_TESTBED_create (controller, */
+  /*                              num_hosts, hosts,  */
+  /*                              num_peers, */
+  /*                              cfg, */
+  /*                              0 /\* FIXME: topology *\/, */
+  /*                              NULL /\* FIXME: topology options *\/); */
 }