aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-29 19:18:54 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-29 19:18:54 +0000
commit905713e8a7392c78dbd3ef89e40b5c6281afd4c5 (patch)
treee0927c02f01331f9855c48b0311390869ba3f869 /src/hostlist
parentfda186a0d462dcbd221118c06a3ec6db6a819088 (diff)
downloadgnunet-905713e8a7392c78dbd3ef89e40b5c6281afd4c5.tar.gz
gnunet-905713e8a7392c78dbd3ef89e40b5c6281afd4c5.zip
convert tests to new transport API
Diffstat (limited to 'src/hostlist')
-rw-r--r--src/hostlist/Makefile.am13
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist.c103
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c121
3 files changed, 156 insertions, 81 deletions
diff --git a/src/hostlist/Makefile.am b/src/hostlist/Makefile.am
index 57fc54f4a..31ce5bf62 100644
--- a/src/hostlist/Makefile.am
+++ b/src/hostlist/Makefile.am
@@ -59,15 +59,20 @@ check_PROGRAMS = \
59 test_gnunet_daemon_hostlist \ 59 test_gnunet_daemon_hostlist \
60 test_gnunet_daemon_hostlist_reconnect \ 60 test_gnunet_daemon_hostlist_reconnect \
61 test_gnunet_daemon_hostlist_learning 61 test_gnunet_daemon_hostlist_learning
62else
63if HAVE_LIBCURL
64check_PROGRAMS = \
65 test_gnunet_daemon_hostlist \
66 test_gnunet_daemon_hostlist_reconnect \
67 test_gnunet_daemon_hostlist_learning
68endif
69endif
62 70
63if HAVE_MHD 71if HAVE_MHD
64if ENABLE_TEST_RUN 72if ENABLE_TEST_RUN
65AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; 73AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;
66TESTS = \ 74TESTS = \
67 test_gnunet_daemon_hostlist \ 75 $(check_PROGRAMS)
68 test_gnunet_daemon_hostlist_reconnect \
69 test_gnunet_daemon_hostlist_learning
70endif
71endif 76endif
72endif 77endif
73 78
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c
index 6a5850c4d..9a1e6d3d7 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2009 GNUnet e.V. 3 Copyright (C) 2009, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -26,6 +26,7 @@
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_arm_service.h" 27#include "gnunet_arm_service.h"
28#include "gnunet_transport_service.h" 28#include "gnunet_transport_service.h"
29#include "gnunet_transport_core_service.h"
29 30
30 31
31/** 32/**
@@ -40,7 +41,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
40struct PeerContext 41struct PeerContext
41{ 42{
42 struct GNUNET_CONFIGURATION_Handle *cfg; 43 struct GNUNET_CONFIGURATION_Handle *cfg;
43 struct GNUNET_TRANSPORT_Handle *th; 44 struct GNUNET_TRANSPORT_CoreHandle *th;
44 struct GNUNET_MessageHeader *hello; 45 struct GNUNET_MessageHeader *hello;
45 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 46 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
46 struct GNUNET_OS_Process *arm_proc; 47 struct GNUNET_OS_Process *arm_proc;
@@ -54,29 +55,30 @@ static struct PeerContext p2;
54static void 55static void
55clean_up (void *cls) 56clean_up (void *cls)
56{ 57{
57 if (p1.th != NULL) 58 if (NULL != p1.th)
58 { 59 {
59 if (p1.ghh != NULL) 60 if (NULL != p1.ghh)
60 { 61 {
61 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); 62 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
62 p1.ghh = NULL; 63 p1.ghh = NULL;
63 } 64 }
64 GNUNET_TRANSPORT_disconnect (p1.th); 65 GNUNET_TRANSPORT_core_disconnect (p1.th);
65 p1.th = NULL; 66 p1.th = NULL;
66 } 67 }
67 if (p2.th != NULL) 68 if (NULL != p2.th)
68 { 69 {
69 if (p2.ghh != NULL) 70 if (NULL != p2.ghh)
70 { 71 {
71 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); 72 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
72 p2.ghh = NULL; 73 p2.ghh = NULL;
73 } 74 }
74 GNUNET_TRANSPORT_disconnect (p2.th); 75 GNUNET_TRANSPORT_core_disconnect (p2.th);
75 p2.th = NULL; 76 p2.th = NULL;
76 } 77 }
77 GNUNET_SCHEDULER_shutdown (); 78 GNUNET_SCHEDULER_shutdown ();
78} 79}
79 80
81
80/** 82/**
81 * Timeout, give up. 83 * Timeout, give up.
82 */ 84 */
@@ -96,24 +98,24 @@ timeout_error (void *cls)
96 * 98 *
97 * @param cls closure 99 * @param cls closure
98 * @param peer the peer that connected 100 * @param peer the peer that connected
99 * @param latency current latency of the connection 101 * @param mq message queue to send messages to the peer
100 * @param distance in overlay hops, as given by transport plugin
101 */ 102 */
102static void 103static void *
103notify_connect (void *cls, 104notify_connect (void *cls,
104 const struct GNUNET_PeerIdentity *peer) 105 const struct GNUNET_PeerIdentity *peer,
106 struct GNUNET_MQ_Handle *mq)
105{ 107{
106 if (peer == NULL)
107 return;
108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Peers connected, shutting down.\n"); 109 "Peers connected, shutting down.\n");
110 ok = 0; 110 ok = 0;
111 if (timeout_task != NULL) 111 if (NULL != timeout_task)
112 { 112 {
113 GNUNET_SCHEDULER_cancel (timeout_task); 113 GNUNET_SCHEDULER_cancel (timeout_task);
114 timeout_task = NULL; 114 timeout_task = NULL;
115 } 115 }
116 GNUNET_SCHEDULER_add_now (&clean_up, NULL); 116 GNUNET_SCHEDULER_add_now (&clean_up,
117 NULL);
118 return NULL;
117} 119}
118 120
119 121
@@ -131,23 +133,38 @@ process_hello (void *cls,
131 133
132 134
133static void 135static void
134setup_peer (struct PeerContext *p, const char *cfgname) 136setup_peer (struct PeerContext *p,
137 const char *cfgname)
135{ 138{
136 char *binary; 139 char *binary;
137 140
138 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 141 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
139 p->cfg = GNUNET_CONFIGURATION_create (); 142 p->cfg = GNUNET_CONFIGURATION_create ();
140 p->arm_proc = 143 p->arm_proc =
141 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 144 GNUNET_OS_start_process (GNUNET_YES,
142 NULL, NULL, NULL, 145 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
146 NULL,
147 NULL,
148 NULL,
143 binary, 149 binary,
144 "gnunet-service-arm", 150 "gnunet-service-arm",
145 "-c", cfgname, NULL); 151 "-c",
146 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 152 cfgname,
147 p->th = 153 NULL);
148 GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, &notify_connect, NULL); 154 GNUNET_assert (GNUNET_OK ==
155 GNUNET_CONFIGURATION_load (p->cfg,
156 cfgname));
157 p->th = GNUNET_TRANSPORT_core_connect (p->cfg,
158 NULL,
159 NULL,
160 p,
161 &notify_connect,
162 NULL,
163 NULL);
149 GNUNET_assert (p->th != NULL); 164 GNUNET_assert (p->th != NULL);
150 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p); 165 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg,
166 &process_hello,
167 p);
151 GNUNET_free (binary); 168 GNUNET_free (binary);
152} 169}
153 170
@@ -157,12 +174,18 @@ waitpid_task (void *cls)
157{ 174{
158 struct PeerContext *p = cls; 175 struct PeerContext *p = cls;
159 176
160 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n"); 177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
161 if (0 != GNUNET_OS_process_kill (p->arm_proc, GNUNET_TERM_SIG)) 178 "Killing ARM process.\n");
162 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 179 if (0 != GNUNET_OS_process_kill (p->arm_proc,
163 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 180 GNUNET_TERM_SIG))
164 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 181 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n", 182 "kill");
183 if (GNUNET_OK !=
184 GNUNET_OS_process_wait (p->arm_proc))
185 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
186 "waitpid");
187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
188 "ARM process %u stopped\n",
166 GNUNET_OS_process_get_pid (p->arm_proc)); 189 GNUNET_OS_process_get_pid (p->arm_proc));
167 GNUNET_OS_process_destroy (p->arm_proc); 190 GNUNET_OS_process_destroy (p->arm_proc);
168 p->arm_proc = NULL; 191 p->arm_proc = NULL;
@@ -176,7 +199,8 @@ stop_arm (struct PeerContext *p)
176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 199 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
177 "Asking ARM to stop core service\n"); 200 "Asking ARM to stop core service\n");
178 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 201 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
179 &waitpid_task, p); 202 &waitpid_task,
203 p);
180} 204}
181 205
182 206
@@ -204,15 +228,18 @@ run (void *cls,
204 NULL); 228 NULL);
205 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, 229 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
206 NULL); 230 NULL);
207 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); 231 setup_peer (&p1,
208 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); 232 "test_gnunet_daemon_hostlist_peer1.conf");
233 setup_peer (&p2,
234 "test_gnunet_daemon_hostlist_peer2.conf");
209} 235}
210 236
211 237
212static int 238static int
213check () 239check ()
214{ 240{
215 char *const argv[] = { "test-gnunet-daemon-hostlist", 241 char *const argv[] = {
242 "test-gnunet-daemon-hostlist",
216 "-c", "test_gnunet_daemon_hostlist_data.conf", 243 "-c", "test_gnunet_daemon_hostlist_data.conf",
217 NULL 244 NULL
218 }; 245 };
@@ -220,8 +247,12 @@ check ()
220 GNUNET_GETOPT_OPTION_END 247 GNUNET_GETOPT_OPTION_END
221 }; 248 };
222 ok = 1; 249 ok = 1;
223 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, 250 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
224 "test-gnunet-daemon-hostlist", "nohelp", options, &run, 251 argv,
252 "test-gnunet-daemon-hostlist",
253 "nohelp",
254 options,
255 &run,
225 &ok); 256 &ok);
226 return ok; 257 return ok;
227} 258}
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index 30f26717f..e0c193ed3 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2010 GNUnet e.V. 3 Copyright (C) 2010, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -19,14 +19,14 @@
19*/ 19*/
20/** 20/**
21 * @file hostlist/test_gnunet_daemon_hostlist_reconnect.c 21 * @file hostlist/test_gnunet_daemon_hostlist_reconnect.c
22 * @brief test for gnunet_daemon_hostslist.c; tries to re-start the peers 22 * @brief test for gnunet-daemon-hostslist.c; tries to re-start the peers
23 * and connect a second time 23 * and connect a second time
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_arm_service.h" 28#include "gnunet_arm_service.h"
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_core_service.h"
30 30
31/** 31/**
32 * How long until we give up on transmitting the message? 32 * How long until we give up on transmitting the message?
@@ -35,12 +35,12 @@
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{
42 struct GNUNET_CONFIGURATION_Handle *cfg; 42 struct GNUNET_CONFIGURATION_Handle *cfg;
43 struct GNUNET_TRANSPORT_Handle *th; 43 struct GNUNET_TRANSPORT_CoreHandle *th;
44 struct GNUNET_MessageHeader *hello; 44 struct GNUNET_MessageHeader *hello;
45 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 45 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
46 struct GNUNET_OS_Process *arm_proc; 46 struct GNUNET_OS_Process *arm_proc;
@@ -70,19 +70,19 @@ timeout_error (void *cls)
70 * 70 *
71 * @param cls closure 71 * @param cls closure
72 * @param peer the peer that connected 72 * @param peer the peer that connected
73 * @param latency current latency of the connection 73 * @param mq message queue to send to @a peer
74 * @param distance in overlay hops, as given by transport plugin 74 * @return NULL
75 */ 75 */
76static void 76static void
77notify_connect (void *cls, 77notify_connect (void *cls,
78 const struct GNUNET_PeerIdentity *peer) 78 const struct GNUNET_PeerIdentity *peer,
79 struct GNUNET_MQ_Handle *mq)
79{ 80{
80 if (peer == NULL)
81 return;
82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
83 "Peers connected, shutting down.\n"); 82 "Peers connected, shutting down.\n");
84 ok = 0; 83 ok = 0;
85 GNUNET_SCHEDULER_shutdown (); 84 GNUNET_SCHEDULER_shutdown ();
85 return NULL;
86} 86}
87 87
88 88
@@ -100,23 +100,38 @@ process_hello (void *cls,
100 100
101 101
102static void 102static void
103setup_peer (struct PeerContext *p, const char *cfgname) 103setup_peer (struct PeerContext *p,
104 const char *cfgname)
104{ 105{
105 char *binary; 106 char *binary;
106 107
107 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 108 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
108 p->cfg = GNUNET_CONFIGURATION_create (); 109 p->cfg = GNUNET_CONFIGURATION_create ();
109 p->arm_proc = 110 p->arm_proc =
110 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 111 GNUNET_OS_start_process (GNUNET_YES,
111 NULL, NULL, NULL, 112 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
113 NULL,
114 NULL,
115 NULL,
112 binary, 116 binary,
113 "gnunet-service-arm", 117 "gnunet-service-arm",
114 "-c", cfgname, NULL); 118 "-c",
115 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 119 cfgname,
116 p->th = 120 NULL);
117 GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, &notify_connect, NULL); 121 GNUNET_assert (GNUNET_OK ==
118 GNUNET_assert (p->th != NULL); 122 GNUNET_CONFIGURATION_load (p->cfg,
119 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p); 123 cfgname));
124 p->th = GNUNET_TRANSPORT_core_connect (p->cfg,
125 NULL,
126 NULL,
127 p,
128 &notify_connect,
129 NULL,
130 NULL);
131 GNUNET_assert (NULL != p->th);
132 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg,
133 &process_hello,
134 p);
120 GNUNET_free (binary); 135 GNUNET_free (binary);
121} 136}
122 137
@@ -126,12 +141,18 @@ waitpid_task (void *cls)
126{ 141{
127 struct PeerContext *p = cls; 142 struct PeerContext *p = cls;
128 143
129 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n"); 144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
130 if (0 != GNUNET_OS_process_kill (p->arm_proc, GNUNET_TERM_SIG)) 145 "Killing ARM process.\n");
131 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 146 if (0 != GNUNET_OS_process_kill (p->arm_proc,
132 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 147 GNUNET_TERM_SIG))
133 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 148 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n", 149 "kill");
150 if (GNUNET_OK !=
151 GNUNET_OS_process_wait (p->arm_proc))
152 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
153 "waitpid");
154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
155 "ARM process %u stopped\n",
135 GNUNET_OS_process_get_pid (p->arm_proc)); 156 GNUNET_OS_process_get_pid (p->arm_proc));
136 GNUNET_OS_process_destroy (p->arm_proc); 157 GNUNET_OS_process_destroy (p->arm_proc);
137 p->arm_proc = NULL; 158 p->arm_proc = NULL;
@@ -142,9 +163,11 @@ waitpid_task (void *cls)
142static void 163static void
143stop_arm (struct PeerContext *p) 164stop_arm (struct PeerContext *p)
144{ 165{
145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ARM to stop core service\n"); 166 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
167 "Asking ARM to stop core service\n");
146 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 168 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
147 &waitpid_task, p); 169 &waitpid_task,
170 p);
148} 171}
149 172
150 173
@@ -164,9 +187,9 @@ shutdown_task (void *cls)
164 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); 187 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
165 p1.ghh = NULL; 188 p1.ghh = NULL;
166 } 189 }
167 if (p1.th != NULL) 190 if (NULL != p1.th)
168 { 191 {
169 GNUNET_TRANSPORT_disconnect (p1.th); 192 GNUNET_TRANSPORT_core_disconnect (p1.th);
170 p1.th = NULL; 193 p1.th = NULL;
171 } 194 }
172 if (NULL != p2.ghh) 195 if (NULL != p2.ghh)
@@ -174,9 +197,9 @@ shutdown_task (void *cls)
174 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); 197 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
175 p2.ghh = NULL; 198 p2.ghh = NULL;
176 } 199 }
177 if (p2.th != NULL) 200 if (NULL != p2.th)
178 { 201 {
179 GNUNET_TRANSPORT_disconnect (p2.th); 202 GNUNET_TRANSPORT_core_disconnect (p2.th);
180 p2.th = NULL; 203 p2.th = NULL;
181 } 204 }
182 stop_arm (&p1); 205 stop_arm (&p1);
@@ -185,22 +208,28 @@ shutdown_task (void *cls)
185 208
186 209
187static void 210static void
188run (void *cls, char *const *args, const char *cfgfile, 211run (void *cls,
212 char *const *args,
213 const char *cfgfile,
189 const struct GNUNET_CONFIGURATION_Handle *cfg) 214 const struct GNUNET_CONFIGURATION_Handle *cfg)
190{ 215{
191 GNUNET_assert (ok == 1); 216 GNUNET_assert (ok == 1);
192 ok++; 217 ok++;
193 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 218 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
194 &timeout_error, NULL); 219 &timeout_error,
220 NULL);
195 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, 221 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
196 NULL); 222 NULL);
197 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); 223 setup_peer (&p1,
198 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); 224 "test_gnunet_daemon_hostlist_peer1.conf");
225 setup_peer (&p2,
226 "test_gnunet_daemon_hostlist_peer2.conf");
199} 227}
200 228
201 229
202int 230int
203main (int argcx, char *argvx[]) 231main (int argcx,
232 char *argvx[])
204{ 233{
205 static char *const argv[] = { 234 static char *const argv[] = {
206 "test-gnunet-daemon-hostlist", 235 "test-gnunet-daemon-hostlist",
@@ -218,18 +247,28 @@ main (int argcx, char *argvx[])
218 "WARNING", 247 "WARNING",
219 NULL); 248 NULL);
220 ok = 1; 249 ok = 1;
221 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, 250 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
222 "test-gnunet-daemon-hostlist", "nohelp", options, &run, 251 argv,
252 "test-gnunet-daemon-hostlist",
253 "nohelp",
254 options,
255 &run,
223 &ok); 256 &ok);
224 if (0 == ok) 257 if (0 == ok)
225 { 258 {
226 FPRINTF (stderr, "%s", "."); 259 FPRINTF (stderr, "%s", ".");
227 /* now do it again */ 260 /* now do it again */
228 ok = 1; 261 ok = 1;
229 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, 262 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
230 "test-gnunet-daemon-hostlist", "nohelp", options, &run, 263 argv,
264 "test-gnunet-daemon-hostlist",
265 "nohelp",
266 options,
267 &run,
231 &ok); 268 &ok);
232 FPRINTF (stderr, "%s", ".\n"); 269 FPRINTF (stderr,
270 "%s",
271 ".\n");
233 } 272 }
234 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1"); 273 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
235 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2"); 274 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");