diff options
author | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-02-04 22:22:15 +0000 |
---|---|---|
committer | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-02-04 22:22:15 +0000 |
commit | 118f67f6f2fd2a61f226b5047ec225391513a2cb (patch) | |
tree | 15c34754990ff6dd82776c54327ebac9c8edb37f /src/testbed | |
parent | 5c703ed45c41644b727a5c9f161b34e9515881d4 (diff) |
- check whether an operation gets cleaned before calling secondary callback
git-svn-id: https://gnunet.org/svn/gnunet@26008 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/testbed_api.c | 14 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 8 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index bf9f18a380..054aa3bfaa 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c @@ -312,6 +312,17 @@ struct SDHandle /** + * 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 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c, 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 @@ GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation) void GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation) { + last_finished_operation = operation; GNUNET_TESTBED_operation_release_ (operation); } diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 6581fffe64..47e0edc897 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -92,6 +92,11 @@ enum State 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 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) 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 @@ event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) 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)); |