static unsigned int num_cont_fails;
/**
- * Number of times we try overlay connect operations
+ * Continuous failures during overlay connect operations
*/
-static unsigned int retry_links;
+static unsigned int cont_fails;
/**
- * Continuous failures during overlay connect operations
+ * Links which are successfully established
*/
-static unsigned int cont_fails;
+static unsigned int established_links;
+
+/**
+ * Links which are not successfully established
+ */
+static unsigned int failed_links;
/**
* Global testing status
topology_op =
GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
-
- num_links);
+ num_links,
+ GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
+ GNUNET_TESTBED_TOPOLOGY_OPTION_END);
}
}
{
prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
printf ("\n%u links established in %.2f seconds\n",
- num_links, ((double) prof_time.rel_value) / 1000.00);
- printf ("Overlay link operations have been retried %u times upon timeouts\n",
- retry_links);
+ established_links, ((double) prof_time.rel_value) / 1000.00);
+ printf ("%u links failed due to timeouts\n", failed_links);
+}
+
+
+/**
+ * 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);
+ }
}
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);
{
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;
/* Control reaches here when a peer linking operation fails */
if (NULL != event->details.operation_finished.emsg)
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _("An operation has failed while linking\n"));
printf ("F");
fflush (stdout);
- retry_links++;
+ failed_links++;
if (++cont_fails > num_cont_fails)
{
printf ("\nAborting due to very high failure rate");
break;
case GNUNET_TESTBED_ET_CONNECT:
{
- static unsigned int established_links;
-
if (0 != cont_fails)
cont_fails--;
if (0 == established_links)
printf ("Establishing links. Please wait\n");
printf (".");
fflush (stdout);
- if (++established_links == num_links)
+ established_links++;
+ if ((established_links + failed_links) == num_links)
{
print_overlay_links_summary ();
result = GNUNET_OK;
* Callback to signal successfull startup of the controller process
*
* @param cls the closure from GNUNET_TESTBED_controller_start()
- * @param cfg the configuration with which the controller has been started;
+ * @param config the configuration with which the controller has been started;
* NULL if status is not GNUNET_OK
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
static void
status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int status)
{
- GNUNET_SCHEDULER_cancel (abort_task);
+ if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+ GNUNET_SCHEDULER_cancel (abort_task);
if (GNUNET_OK != status)
{
mc_proc = NULL;
abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
return;
}
- register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, NULL);
+ if (num_hosts > 1)
+ register_hosts_task = GNUNET_SCHEDULER_add_now (®ister_hosts, NULL);
+ else
+ start_peers ();
abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_abort, NULL);
}