diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-04 22:22:15 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-02-04 22:22:15 +0000 |
commit | 17c860b4bd0d0d0afa5002c6c08c6a21763c23e8 (patch) | |
tree | 15c34754990ff6dd82776c54327ebac9c8edb37f /src/testbed/testbed_api.c | |
parent | 9815c9428b6cffa128244d2186197adf7208b7ee (diff) | |
download | gnunet-17c860b4bd0d0d0afa5002c6c08c6a21763c23e8.tar.gz gnunet-17c860b4bd0d0d0afa5002c6c08c6a21763c23e8.zip |
- check whether an operation gets cleaned before calling secondary callback
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r-- | src/testbed/testbed_api.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index bf9f18a38..054aa3bfa 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -312,6 +312,17 @@ struct SDHandle | |||
312 | 312 | ||
313 | 313 | ||
314 | /** | 314 | /** |
315 | * This variable is set to the operation that has been last marked as done. It | ||
316 | * is used to verify whether the state associated with an operation is valid | ||
317 | * after the first notify callback is called. Such checks are necessary for | ||
318 | * certain operations where we have 2 notify callbacks. Examples are | ||
319 | * OP_PEER_CREATE, OP_PEER_START/STOP, OP_OVERLAY_CONNECT. | ||
320 | * | ||
321 | * This variable should ONLY be used to compare; it is a dangling pointer!! | ||
322 | */ | ||
323 | static const struct GNUNET_TESTBED_Operation *last_finished_operation; | ||
324 | |||
325 | /** | ||
315 | * Initialize standard deviation calculation handle | 326 | * Initialize standard deviation calculation handle |
316 | * | 327 | * |
317 | * @param max_cnt the maximum number of readings to keep | 328 | * @param max_cnt the maximum number of readings to keep |
@@ -909,6 +920,8 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c, | |||
909 | event.details.operation_finished.emsg = emsg; | 920 | event.details.operation_finished.emsg = emsg; |
910 | event.details.operation_finished.generic = NULL; | 921 | event.details.operation_finished.generic = NULL; |
911 | c->cc (c->cc_cls, &event); | 922 | c->cc (c->cc_cls, &event); |
923 | if (event.details.operation_finished.operation == last_finished_operation) | ||
924 | return GNUNET_YES; | ||
912 | } | 925 | } |
913 | switch (opc->type) | 926 | switch (opc->type) |
914 | { | 927 | { |
@@ -2468,6 +2481,7 @@ GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation) | |||
2468 | void | 2481 | void |
2469 | GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation) | 2482 | GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation) |
2470 | { | 2483 | { |
2484 | last_finished_operation = operation; | ||
2471 | GNUNET_TESTBED_operation_release_ (operation); | 2485 | GNUNET_TESTBED_operation_release_ (operation); |
2472 | } | 2486 | } |
2473 | 2487 | ||