[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24307 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24307 - gnunet/src/testbed |
Date: |
Sun, 14 Oct 2012 14:36:28 +0200 |
Author: harsha
Date: 2012-10-14 14:36:28 +0200 (Sun, 14 Oct 2012)
New Revision: 24307
Modified:
gnunet/src/testbed/gnunet-testbed-profiler.c
Log:
peer start
Modified: gnunet/src/testbed/gnunet-testbed-profiler.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-profiler.c 2012-10-14 12:21:48 UTC
(rev 24306)
+++ gnunet/src/testbed/gnunet-testbed-profiler.c 2012-10-14 12:36:28 UTC
(rev 24307)
@@ -241,6 +241,42 @@
/**
* Functions of this signature are called when a peer has been successfully
+ * started or stopped.
+ *
+ * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
+ * @param emsg NULL on success; otherwise an error description
+ */
+static void
+peer_churn_cb (void *cls, const char *emsg)
+{
+ struct DLLOperation *dll_op = cls;
+ struct GNUNET_TESTBED_Operation *op;
+ static unsigned int started_peers;
+
+ op = dll_op->op;
+ GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
+ GNUNET_free (dll_op);
+ if (NULL != emsg)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ _("An operation has failed while starting peers\n"));
+ GNUNET_TESTBED_operation_done (op);
+ GNUNET_SCHEDULER_cancel (abort_task);
+ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
+ return;
+ }
+ GNUNET_TESTBED_operation_done (op);
+ if (++started_peers == num_peers)
+ {
+ prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
+ printf ("All peers started successfully in %.2f seconds\n",
+ ((double) prof_time.rel_value) / 1000.00);
+ }
+}
+
+
+/**
+ * Functions of this signature are called when a peer has been successfully
* created
*
* @param cls the closure from GNUNET_TESTBED_peer_create()
@@ -283,7 +319,8 @@
for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->op = GNUNET_TESTBED_peer_start (NULL, peers[peer_cnt], NULL,
NULL);
+ dll_op->op = GNUNET_TESTBED_peer_start (NULL, peers[peer_cnt],
+ &peer_churn_cb, dll_op);
GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
}
}
@@ -359,10 +396,8 @@
{
case GNUNET_TESTBED_ET_OPERATION_FINISHED:
/* Control reaches here when peer start fails */
- GNUNET_break (0);
- break;
case GNUNET_TESTBED_ET_PEER_START:
- GNUNET_break (0);
+ /* we handle peer starts in peer_churn_cb */
break;
default:
GNUNET_assert (0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24307 - gnunet/src/testbed,
gnunet <=