removing remenants of abstract unix domain socket handling, this finishes addressing...
[oweals/gnunet.git] / src / testbed / gnunet-testbed-profiler.c
index a5a4c2350e8b25cf215f990d471138121b7584f0..c6c472f92a6b183f5dacbb517106d7b0f025149c 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+     (C) 2008--2013 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -25,7 +25,6 @@
  */
 
 #include "platform.h"
-#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testbed_service.h"
 #include "testbed_api_hosts.h"
@@ -50,7 +49,7 @@ struct GNUNET_TESTBED_Operation *topology_op;
 /**
  * Name of the file with the hosts to run the test over (configuration option).
  * It will be NULL if ENABLE_LL is set
- */ 
+ */
 static char *hosts_file;
 
 /**
@@ -110,9 +109,15 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   shutdown_task = GNUNET_SCHEDULER_NO_TASK;
   if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+  {
     GNUNET_SCHEDULER_cancel (abort_task);
+    abort_task = GNUNET_SCHEDULER_NO_TASK;
+  }
   if (NULL != cfg)
+  {
     GNUNET_CONFIGURATION_destroy (cfg);
+    cfg = NULL;
+  }
   GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
 }
 
@@ -175,7 +180,8 @@ controller_event_cb (void *cls,
       {
         printf ("\nAborting due to very high failure rate\n");
         print_overlay_links_summary ();
-        GNUNET_SCHEDULER_cancel (abort_task);
+        if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+         GNUNET_SCHEDULER_cancel (abort_task);
         abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
         return;
       }
@@ -202,6 +208,7 @@ controller_event_cb (void *cls,
  * Signature of a main function for a testcase.
  *
  * @param cls closure
+ * @param h the run handle
  * @param num_peers number of peers in 'peers'
  * @param peers handle to peers run in the testbed
  * @param links_succeeded the number of overlay link connection attempts that
@@ -209,16 +216,20 @@ controller_event_cb (void *cls,
  * @param links_failed the number of overlay link
  */
 static void
-test_run (void *cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
+test_run (void *cls,
+          struct GNUNET_TESTBED_RunHandle *h,
+          unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
           unsigned int links_succeeded,
           unsigned int links_failed)
 {
   result = GNUNET_OK;
   fprintf (stdout, "\n");
   print_overlay_links_summary ();
+#if !ENABLE_LL
   fprintf (stdout, "Testbed running, waiting for keystroke to shut down\n");
   fflush (stdout);
   (void) getc (stdin);
+#endif
   fprintf (stdout, "Shutting down. Please wait\n");
   fflush (stdout);
   shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);