diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:23:08 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:23:08 +0000 |
commit | 556b586c5d998902b3e9d8ca1dd7ae9be8d8f2ca (patch) | |
tree | 31cb0a2d2bd6346e989ca9e5b2886cdb4e4907dd | |
parent | 8a03ca53dd08d834b4d235dcae865e5c699d50ab (diff) | |
download | gnunet-556b586c5d998902b3e9d8ca1dd7ae9be8d8f2ca.tar.gz gnunet-556b586c5d998902b3e9d8ca1dd7ae9be8d8f2ca.zip |
shutdown callback
-rw-r--r-- | src/topology/test_gnunet_daemon_topology.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c index a96096455..047d5de8c 100644 --- a/src/topology/test_gnunet_daemon_topology.c +++ b/src/topology/test_gnunet_daemon_topology.c | |||
@@ -50,12 +50,35 @@ static struct GNUNET_TESTING_Daemon *last; | |||
50 | 50 | ||
51 | static struct GNUNET_SCHEDULER_Handle *sched; | 51 | static struct GNUNET_SCHEDULER_Handle *sched; |
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 | } | ||
53 | 76 | ||
54 | static void | 77 | static void |
55 | clean_up_task (void *cls, | 78 | clean_up_task (void *cls, |
56 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 79 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
57 | { | 80 | { |
58 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 81 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
59 | ok = 0; | 82 | ok = 0; |
60 | } | 83 | } |
61 | 84 | ||
@@ -76,7 +99,7 @@ notify_connect_complete(void *cls, | |||
76 | fprintf (stderr, | 99 | fprintf (stderr, |
77 | "Failed to connect two peers: %s\n", | 100 | "Failed to connect two peers: %s\n", |
78 | emsg); | 101 | emsg); |
79 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 102 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
80 | GNUNET_assert (0); | 103 | GNUNET_assert (0); |
81 | return; | 104 | return; |
82 | } | 105 | } |