diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:21:40 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:21:40 +0000 |
commit | 134afc9acfb4b12c84cdf8b56b2eabb856fde3e7 (patch) | |
tree | f62956e6c9ac0b39f37afc101270ce8660004831 /src/testing/test_testing_group_remote.c | |
parent | 59ca0059f61b1e2538f2890625601a88b2119f66 (diff) | |
download | gnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.tar.gz gnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.zip |
callback for peergroup shutdown in testing, requisite testcase changes
Diffstat (limited to 'src/testing/test_testing_group_remote.c')
-rw-r--r-- | src/testing/test_testing_group_remote.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/testing/test_testing_group_remote.c b/src/testing/test_testing_group_remote.c index 6b7fabb31..562e858e5 100644 --- a/src/testing/test_testing_group_remote.c +++ b/src/testing/test_testing_group_remote.c | |||
@@ -50,6 +50,30 @@ static unsigned long long num_peers; | |||
50 | 50 | ||
51 | static char *hostnames; | 51 | static char *hostnames; |
52 | 52 | ||
53 | /** | ||
54 | * Check whether peers successfully shut down. | ||
55 | */ | ||
56 | void shutdown_callback (void *cls, | ||
57 | const char *emsg) | ||
58 | { | ||
59 | if (emsg != NULL) | ||
60 | { | ||
61 | #if VERBOSE | ||
62 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
63 | "Shutdown of peers failed!\n"); | ||
64 | #endif | ||
65 | if (ok == 0) | ||
66 | ok = 666; | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | #if VERBOSE | ||
71 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
72 | "All peers successfully shut down!\n"); | ||
73 | #endif | ||
74 | } | ||
75 | } | ||
76 | |||
53 | 77 | ||
54 | static void | 78 | static void |
55 | my_cb (void *cls, | 79 | my_cb (void *cls, |
@@ -65,13 +89,13 @@ my_cb (void *cls, | |||
65 | peers_left--; | 89 | peers_left--; |
66 | if (peers_left == 0) | 90 | if (peers_left == 0) |
67 | { | 91 | { |
68 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 92 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
69 | ok = 0; | 93 | ok = 0; |
70 | } | 94 | } |
71 | else if (peers_failed == peers_left) | 95 | else if (peers_failed == peers_left) |
72 | { | 96 | { |
73 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 97 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); |
74 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 98 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
75 | } | 99 | } |
76 | } | 100 | } |
77 | 101 | ||