[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26008 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26008 - gnunet/src/testbed |
Date: |
Mon, 4 Feb 2013 23:22:15 +0100 |
Author: harsha
Date: 2013-02-04 23:22:15 +0100 (Mon, 04 Feb 2013)
New Revision: 26008
Modified:
gnunet/src/testbed/testbed_api.c
gnunet/src/testbed/testbed_api_testbed.c
Log:
- check whether an operation gets cleaned before calling secondary callback
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2013-02-04 16:54:59 UTC (rev 26007)
+++ gnunet/src/testbed/testbed_api.c 2013-02-04 22:22:15 UTC (rev 26008)
@@ -312,6 +312,17 @@
/**
+ * This variable is set to the operation that has been last marked as done. It
+ * is used to verify whether the state associated with an operation is valid
+ * after the first notify callback is called. Such checks are necessary for
+ * certain operations where we have 2 notify callbacks. Examples are
+ * OP_PEER_CREATE, OP_PEER_START/STOP, OP_OVERLAY_CONNECT.
+ *
+ * This variable should ONLY be used to compare; it is a dangling pointer!!
+ */
+static const struct GNUNET_TESTBED_Operation *last_finished_operation;
+
+/**
* Initialize standard deviation calculation handle
*
* @param max_cnt the maximum number of readings to keep
@@ -909,6 +920,8 @@
event.details.operation_finished.emsg = emsg;
event.details.operation_finished.generic = NULL;
c->cc (c->cc_cls, &event);
+ if (event.details.operation_finished.operation == last_finished_operation)
+ return GNUNET_YES;
}
switch (opc->type)
{
@@ -2468,6 +2481,7 @@
void
GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
{
+ last_finished_operation = operation;
GNUNET_TESTBED_operation_release_ (operation);
}
Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c 2013-02-04 16:54:59 UTC (rev
26007)
+++ gnunet/src/testbed/testbed_api_testbed.c 2013-02-04 22:22:15 UTC (rev
26008)
@@ -92,6 +92,11 @@
RC_LINKED,
/**
+ * Peers are created
+ */
+ RC_PEERS_CREATED,
+
+ /**
* The testbed run is ready and the master callback can be called now. At
this
* time the peers are all started and if a topology is provided in the
* configuration the topology would have been attempted
@@ -356,6 +361,7 @@
if (rc->peer_count < rc->num_peers)
return;
DEBUG ("%u peers created in %s\n", rc->num_peers, prof_time (rc));
+ rc->state = RC_PEERS_CREATED;
GNUNET_SCHEDULER_add_now (&start_peers_task, rc);
}
@@ -675,7 +681,7 @@
return;
switch (rc->state)
{
- case RC_LINKED:
+ case RC_PEERS_CREATED:
case RC_READY:
rc->state = RC_PEERS_STOPPED;
DEBUG ("Peers stopped in %s\n", prof_time (rc));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26008 - gnunet/src/testbed,
gnunet <=