diff options
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_testing_peerstartup2.c | 8 | ||||
-rw-r--r-- | src/testing/testing.c | 18 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/testing/test_testing_peerstartup2.c b/src/testing/test_testing_peerstartup2.c index cd8141b40..959651041 100644 --- a/src/testing/test_testing_peerstartup2.c +++ b/src/testing/test_testing_peerstartup2.c | |||
@@ -148,10 +148,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
148 | GNUNET_TESTING_peer_stop_async (test_ctx->peer, | 148 | GNUNET_TESTING_peer_stop_async (test_ctx->peer, |
149 | &peer_status_cb, | 149 | &peer_status_cb, |
150 | test_ctx)); | 150 | test_ctx)); |
151 | |||
152 | } | 151 | } |
153 | else | 152 | else |
154 | do_shutdown (test_ctx, tc); | 153 | do_shutdown2 (test_ctx, tc); |
155 | } | 154 | } |
156 | 155 | ||
157 | 156 | ||
@@ -187,6 +186,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
187 | if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer)) | 186 | if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer)) |
188 | goto end; | 187 | goto end; |
189 | test_ctx->state = PEER_STARTED; | 188 | test_ctx->state = PEER_STARTED; |
189 | FAIL_TEST (GNUNET_OK == | ||
190 | GNUNET_TESTING_peer_stop_async (test_ctx->peer, | ||
191 | &peer_status_cb, | ||
192 | test_ctx)); | ||
193 | GNUNET_TESTING_peer_stop_async_cancel (test_ctx->peer); | ||
190 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 194 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
191 | &do_shutdown, test_ctx); | 195 | &do_shutdown, test_ctx); |
192 | return; | 196 | return; |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 1b2448ffc..f268c38d1 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1539,6 +1539,24 @@ GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, | |||
1539 | 1539 | ||
1540 | 1540 | ||
1541 | /** | 1541 | /** |
1542 | * Cancel a previous asynchronous peer stop request. | ||
1543 | * GNUNET_TESTING_peer_stop_async() should have been called before on the given | ||
1544 | * peer. It is an error to call this function if the peer stop callback was | ||
1545 | * already called | ||
1546 | * | ||
1547 | * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called | ||
1548 | * before. | ||
1549 | */ | ||
1550 | void | ||
1551 | GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer) | ||
1552 | { | ||
1553 | GNUNET_assert (NULL != peer->ah); | ||
1554 | GNUNET_ARM_disconnect_and_free (peer->ah); | ||
1555 | peer->ah = NULL; | ||
1556 | } | ||
1557 | |||
1558 | |||
1559 | /** | ||
1542 | * Destroy the peer. Releases resources locked during peer configuration. | 1560 | * Destroy the peer. Releases resources locked during peer configuration. |
1543 | * If the peer is still running, it will be stopped AND a warning will be | 1561 | * If the peer is still running, it will be stopped AND a warning will be |
1544 | * printed (users of the API should stop the peer explicitly first). | 1562 | * printed (users of the API should stop the peer explicitly first). |