gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24459 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r24459 - gnunet/src/testbed
Date: Mon, 22 Oct 2012 17:09:12 +0200

Author: harsha
Date: 2012-10-22 17:09:12 +0200 (Mon, 22 Oct 2012)
New Revision: 24459

Modified:
   gnunet/src/testbed/gnunet-testbed-profiler.c
Log:
allow single host deployments

Modified: gnunet/src/testbed/gnunet-testbed-profiler.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-profiler.c        2012-10-22 14:25:23 UTC 
(rev 24458)
+++ gnunet/src/testbed/gnunet-testbed-profiler.c        2012-10-22 15:09:12 UTC 
(rev 24459)
@@ -415,6 +415,34 @@
 
 
 /**
+ * Function to start peers
+ */
+static void
+start_peers ()
+{
+  struct DLLOperation *dll_op;
+  unsigned int peer_cnt;
+  
+  state = STATE_PEERS_CREATING;
+  prof_start_time = GNUNET_TIME_absolute_get ();
+  peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *)
+                         * num_peers);
+  for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
+  {
+    dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
+    dll_op->cls = &peers[peer_cnt];
+    dll_op->op = GNUNET_TESTBED_peer_create (mc,
+                                             hosts
+                                             [peer_cnt % num_hosts],
+                                             cfg,
+                                             &peer_create_cb,
+                                             dll_op);
+    GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
+  }
+}
+
+
+/**
  * Controller event callback
  *
  * @param cls NULL
@@ -435,7 +463,6 @@
     case GNUNET_TESTBED_ET_OPERATION_FINISHED:
       {
         static unsigned int slaves_started;
-        unsigned int peer_cnt;
         
         dll_op = event->details.operation_finished.op_cls;
         GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
@@ -456,22 +483,7 @@
         {
           printf ("%u controllers started successfully\n", num_hosts);
          fflush (stdout);
-          state = STATE_PEERS_CREATING;
-          prof_start_time = GNUNET_TIME_absolute_get ();
-          peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *)
-                                 * num_peers);
-          for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
-          {
-            dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
-            dll_op->cls = &peers[peer_cnt];
-            dll_op->op = GNUNET_TESTBED_peer_create (mc,
-                                                     hosts
-                                                     [peer_cnt % num_hosts],
-                                                     cfg,
-                                                     &peer_create_cb,
-                                                     dll_op);
-            GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, 
dll_op);
-          }
+          start_peers ();
         }
       }
       break;
@@ -643,7 +655,10 @@
     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
     return;
   }
-  register_hosts_task = GNUNET_SCHEDULER_add_now (&register_hosts, NULL);
+  if (num_hosts > 1)
+    register_hosts_task = GNUNET_SCHEDULER_add_now (&register_hosts, NULL);
+  else
+    start_peers ();
   abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                              &do_abort, NULL);
 }




reply via email to

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