aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/test_gnunet_daemon_hostlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist.c')
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c
index 2f99b887d..5f8ece9b8 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist.c
@@ -35,7 +35,7 @@
35 35
36static int ok; 36static int ok;
37 37
38static struct GNUNET_SCHEDULER_Task * timeout_task; 38static struct GNUNET_SCHEDULER_Task *timeout_task;
39 39
40struct PeerContext 40struct PeerContext
41{ 41{
@@ -100,11 +100,13 @@ timeout_error (void *cls)
100 * @param distance in overlay hops, as given by transport plugin 100 * @param distance in overlay hops, as given by transport plugin
101 */ 101 */
102static void 102static void
103notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) 103notify_connect (void *cls,
104 const struct GNUNET_PeerIdentity *peer)
104{ 105{
105 if (peer == NULL) 106 if (peer == NULL)
106 return; 107 return;
107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Peers connected, shutting down.\n");
108 ok = 0; 110 ok = 0;
109 if (timeout_task != NULL) 111 if (timeout_task != NULL)
110 { 112 {
@@ -116,7 +118,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
116 118
117 119
118static void 120static void
119process_hello (void *cls, const struct GNUNET_MessageHeader *message) 121process_hello (void *cls,
122 const struct GNUNET_MessageHeader *message)
120{ 123{
121 struct PeerContext *p = cls; 124 struct PeerContext *p = cls;
122 125
@@ -170,8 +173,10 @@ waitpid_task (void *cls)
170static void 173static void
171stop_arm (struct PeerContext *p) 174stop_arm (struct PeerContext *p)
172{ 175{
173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ARM to stop core service\n"); 176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
174 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &waitpid_task, p); 177 "Asking ARM to stop core service\n");
178 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
179 &waitpid_task, p);
175} 180}
176 181
177 182
@@ -187,14 +192,18 @@ shutdown_task (void *cls)
187 192
188 193
189static void 194static void
190run (void *cls, char *const *args, const char *cfgfile, 195run (void *cls,
196 char *const *args,
197 const char *cfgfile,
191 const struct GNUNET_CONFIGURATION_Handle *cfg) 198 const struct GNUNET_CONFIGURATION_Handle *cfg)
192{ 199{
193 GNUNET_assert (ok == 1); 200 GNUNET_assert (ok == 1);
194 ok++; 201 ok++;
195 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_error, NULL); 202 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
196 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 203 &timeout_error,
197 NULL); 204 NULL);
205 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
206 NULL);
198 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); 207 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf");
199 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); 208 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf");
200} 209}