diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-31 12:52:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-31 12:52:37 +0000 |
commit | c0d23c3d48800d92773a7e65cf1eb19998da98b5 (patch) | |
tree | c0061c0dc56e2885262f3c740e22124a065ce655 /src/transport/test_transport_api_multiaddress.c | |
parent | 04957eb0bb2fcf2b1566a75496154fc4e61c116e (diff) | |
download | gnunet-c0d23c3d48800d92773a7e65cf1eb19998da98b5.tar.gz gnunet-c0d23c3d48800d92773a7e65cf1eb19998da98b5.zip |
migrated multiaddress to testing framework
+ progress entertainment
Diffstat (limited to 'src/transport/test_transport_api_multiaddress.c')
-rw-r--r-- | src/transport/test_transport_api_multiaddress.c | 332 |
1 files changed, 173 insertions, 159 deletions
diff --git a/src/transport/test_transport_api_multiaddress.c b/src/transport/test_transport_api_multiaddress.c index 8748e5f6c..1dc16dd01 100644 --- a/src/transport/test_transport_api_multiaddress.c +++ b/src/transport/test_transport_api_multiaddress.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * the correct test case will be performed. Conservation of | 26 | * the correct test case will be performed. Conservation of |
27 | * C code apparently. | 27 | * C code apparently. |
28 | */ | 28 | */ |
29 | |||
29 | #include "platform.h" | 30 | #include "platform.h" |
30 | #include "gnunet_common.h" | 31 | #include "gnunet_common.h" |
31 | #include "gnunet_hello_lib.h" | 32 | #include "gnunet_hello_lib.h" |
@@ -46,26 +47,34 @@ | |||
46 | /** | 47 | /** |
47 | * How long until we give up on transmitting the message? | 48 | * How long until we give up on transmitting the message? |
48 | */ | 49 | */ |
49 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 50 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
50 | 51 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90) | |
51 | /** | ||
52 | * How long until we give up on transmitting the message? | ||
53 | */ | ||
54 | #define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
55 | 52 | ||
56 | #define MTYPE 12345 | 53 | #define MTYPE 12345 |
57 | 54 | ||
58 | static struct PeerContext p1; | 55 | static int ok; |
59 | 56 | ||
60 | static struct PeerContext p2; | 57 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
61 | 58 | ||
62 | static int ok; | 59 | static GNUNET_SCHEDULER_TaskIdentifier timer_task; |
63 | 60 | ||
64 | static int is_tcp; | 61 | struct PeerContext *p1; |
65 | 62 | ||
66 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 63 | struct PeerContext *p2; |
64 | |||
65 | static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; | ||
67 | 66 | ||
68 | static GNUNET_SCHEDULER_TaskIdentifier tct; | 67 | struct GNUNET_TRANSPORT_TransmitHandle *th; |
68 | |||
69 | char *cfg_file_p1; | ||
70 | |||
71 | char *cfg_file_p2; | ||
72 | |||
73 | static struct GNUNET_TIME_Relative time_running; | ||
74 | |||
75 | static int shutdown_flag; | ||
76 | |||
77 | static int disconnects; | ||
69 | 78 | ||
70 | 79 | ||
71 | #if VERBOSE | 80 | #if VERBOSE |
@@ -75,93 +84,81 @@ static GNUNET_SCHEDULER_TaskIdentifier tct; | |||
75 | #endif | 84 | #endif |
76 | 85 | ||
77 | 86 | ||
78 | |||
79 | static void | 87 | static void |
80 | stop_arm (struct PeerContext *p) | 88 | end () |
81 | { | 89 | { |
82 | #if START_ARM | 90 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); |
83 | if (NULL != p->arm_proc) | 91 | |
92 | if (timer_task != GNUNET_SCHEDULER_NO_TASK) | ||
84 | { | 93 | { |
85 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) | 94 | GNUNET_SCHEDULER_cancel (timer_task); |
86 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 95 | timer_task = GNUNET_SCHEDULER_NO_TASK; |
87 | GNUNET_OS_process_wait (p->arm_proc); | ||
88 | GNUNET_OS_process_close (p->arm_proc); | ||
89 | p->arm_proc = NULL; | ||
90 | } | 96 | } |
91 | #endif | ||
92 | GNUNET_CONFIGURATION_destroy (p->cfg); | ||
93 | } | ||
94 | |||
95 | |||
96 | 97 | ||
98 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | ||
99 | { | ||
100 | GNUNET_SCHEDULER_cancel (die_task); | ||
101 | die_task = GNUNET_SCHEDULER_NO_TASK; | ||
102 | } | ||
97 | 103 | ||
98 | static void | 104 | if (th != NULL) |
99 | exchange_hello_last (void *cls, const struct GNUNET_MessageHeader *message) | 105 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); |
100 | { | 106 | th = NULL; |
101 | struct PeerContext *me = cls; | ||
102 | 107 | ||
103 | GNUNET_assert (message != NULL); | ||
104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
105 | "Exchanging HELLO of size %d with peer (%s)!\n", | ||
106 | (int) GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) | ||
107 | message), GNUNET_i2s (&me->id)); | ||
108 | GNUNET_assert (GNUNET_OK == | ||
109 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | ||
110 | message, &me->id)); | ||
111 | GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL); | ||
112 | } | ||
113 | 108 | ||
109 | GNUNET_TRANSPORT_TESTING_stop_peer (p1); | ||
110 | GNUNET_TRANSPORT_TESTING_stop_peer (p2); | ||
114 | 111 | ||
115 | static void | 112 | if (disconnects == 0) |
116 | exchange_hello (void *cls, const struct GNUNET_MessageHeader *message) | 113 | ok = 0; |
117 | { | 114 | else |
118 | struct PeerContext *me = cls; | 115 | { |
119 | 116 | ok = disconnects; | |
120 | GNUNET_assert (message != NULL); | 117 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
121 | GNUNET_assert (GNUNET_OK == | 118 | "Fail! Had %u disconnects while waiting %llu seconds \n", |
122 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | 119 | disconnects, WAIT.rel_value); |
123 | message, &me->id)); | 120 | } |
124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
125 | "Exchanging HELLO of size %d from peer %s!\n", | ||
126 | (int) GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) | ||
127 | message), GNUNET_i2s (&me->id)); | ||
128 | GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); | ||
129 | } | 121 | } |
130 | 122 | ||
131 | |||
132 | static void | 123 | static void |
133 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 124 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
134 | { | 125 | { |
135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); | ||
136 | GNUNET_break (0); | ||
137 | die_task = GNUNET_SCHEDULER_NO_TASK; | 126 | die_task = GNUNET_SCHEDULER_NO_TASK; |
138 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); | 127 | |
139 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); | 128 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); |
140 | GNUNET_TRANSPORT_disconnect (p1.th); | 129 | |
141 | GNUNET_TRANSPORT_disconnect (p2.th); | 130 | if (timer_task != GNUNET_SCHEDULER_NO_TASK) |
142 | if (GNUNET_SCHEDULER_NO_TASK != tct) | ||
143 | { | 131 | { |
144 | GNUNET_SCHEDULER_cancel (tct); | 132 | GNUNET_SCHEDULER_cancel (timer_task); |
145 | tct = GNUNET_SCHEDULER_NO_TASK; | 133 | timer_task = GNUNET_SCHEDULER_NO_TASK; |
146 | } | 134 | } |
147 | ok = 1; | 135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "1\n"); |
136 | if (cc != NULL) | ||
137 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc); | ||
138 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "2\n"); | ||
139 | if (th != NULL) | ||
140 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); | ||
141 | th = NULL; | ||
142 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "3\n"); | ||
143 | if (p1 != NULL) | ||
144 | GNUNET_TRANSPORT_TESTING_stop_peer (p1); | ||
145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "4\n"); | ||
146 | if (p2 != NULL) | ||
147 | GNUNET_TRANSPORT_TESTING_stop_peer (p2); | ||
148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "5\n"); | ||
149 | ok = GNUNET_SYSERR; | ||
148 | } | 150 | } |
149 | 151 | ||
152 | |||
150 | static void | 153 | static void |
151 | end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 154 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
155 | const struct GNUNET_MessageHeader *message, | ||
156 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | ||
157 | uint32_t ats_count) | ||
152 | { | 158 | { |
153 | ok = 60; | 159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
154 | die_task = GNUNET_SCHEDULER_NO_TASK; | 160 | "Received message of type %d from peer %s!\n", |
155 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); | 161 | ntohs (message->type), GNUNET_i2s (peer)); |
156 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); | ||
157 | GNUNET_TRANSPORT_disconnect (p1.th); | ||
158 | GNUNET_TRANSPORT_disconnect (p2.th); | ||
159 | if (GNUNET_SCHEDULER_NO_TASK != tct) | ||
160 | { | ||
161 | GNUNET_SCHEDULER_cancel (tct); | ||
162 | tct = GNUNET_SCHEDULER_NO_TASK; | ||
163 | } | ||
164 | ok = 0; | ||
165 | } | 162 | } |
166 | 163 | ||
167 | static void | 164 | static void |
@@ -171,103 +168,90 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
171 | { | 168 | { |
172 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", | 169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", |
173 | GNUNET_i2s (peer), cls); | 170 | GNUNET_i2s (peer), cls); |
174 | if (cls == &p1) | ||
175 | { | ||
176 | GNUNET_assert (ok >= 2); | ||
177 | OKPP; | ||
178 | OKPP; | ||
179 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | ||
180 | GNUNET_SCHEDULER_cancel (die_task); | ||
181 | if (GNUNET_SCHEDULER_NO_TASK != tct) | ||
182 | GNUNET_SCHEDULER_cancel (tct); | ||
183 | tct = GNUNET_SCHEDULER_NO_TASK; | ||
184 | die_task = | ||
185 | GNUNET_SCHEDULER_add_delayed (TIMEOUT_TRANSMIT, &end_normally, NULL); | ||
186 | } | ||
187 | } | 171 | } |
188 | 172 | ||
189 | 173 | ||
190 | static void | 174 | static void |
191 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | 175 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) |
192 | { | 176 | { |
193 | if ((ok != 60) && (GNUNET_SCHEDULER_NO_TASK != die_task)) | 177 | if (shutdown_flag != GNUNET_YES) |
194 | { | 178 | { |
195 | GNUNET_SCHEDULER_cancel (die_task); | 179 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
196 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 180 | "FAIL! Peer `%4s' disconnected during waiting period!\n", |
181 | GNUNET_i2s (peer)); | ||
182 | disconnects++; | ||
197 | } | 183 | } |
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' disconnected (%p)!\n", | ||
199 | GNUNET_i2s (peer), cls); | ||
200 | } | 184 | } |
201 | 185 | ||
202 | |||
203 | static void | 186 | static void |
204 | setup_peer (struct PeerContext *p, const char *cfgname) | 187 | timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
205 | { | 188 | { |
206 | p->cfg = GNUNET_CONFIGURATION_create (); | 189 | static int percentage; |
190 | |||
191 | timer_task = GNUNET_SCHEDULER_NO_TASK; | ||
192 | |||
193 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | ||
194 | return; | ||
195 | |||
196 | percentage += 10; | ||
197 | time_running = | ||
198 | GNUNET_TIME_relative_add (time_running, | ||
199 | GNUNET_TIME_relative_divide (WAIT, 10)); | ||
207 | 200 | ||
208 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 201 | if (time_running.rel_value == |
209 | if (GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME")) | 202 | GNUNET_TIME_relative_max (time_running, WAIT).rel_value) |
210 | { | 203 | { |
211 | GNUNET_assert (GNUNET_OK == | 204 | fprintf (stderr, "100%%\n"); |
212 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS", | 205 | shutdown_flag = GNUNET_YES; |
213 | "SERVICEHOME", | 206 | GNUNET_SCHEDULER_add_now (&end, NULL); |
214 | &p->servicehome)); | 207 | } |
215 | GNUNET_DISK_directory_remove (p->servicehome); | 208 | else |
209 | { | ||
210 | fprintf (stderr, "%u%%..", percentage); | ||
211 | timer_task = | ||
212 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10), | ||
213 | &timer, NULL); | ||
216 | } | 214 | } |
217 | |||
218 | #if START_ARM | ||
219 | p->arm_proc = | ||
220 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | ||
221 | "gnunet-service-arm", | ||
222 | #if VERBOSE_ARM | ||
223 | "-L", "DEBUG", | ||
224 | #endif | ||
225 | "-c", cfgname, NULL); | ||
226 | #endif | ||
227 | p->th = | ||
228 | GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, | ||
229 | ¬ify_disconnect); | ||
230 | GNUNET_assert (p->th != NULL); | ||
231 | } | 215 | } |
232 | 216 | ||
233 | |||
234 | static void | 217 | static void |
235 | try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 218 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) |
236 | { | 219 | { |
237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking peers to connect...\n"); | 220 | cc = NULL; |
238 | /* FIXME: 'pX.id' may still be all-zeros here... */ | 221 | char *p1_c = strdup (GNUNET_i2s (&p1->id)); |
239 | GNUNET_TRANSPORT_try_connect (p2.th, &p1.id); | ||
240 | GNUNET_TRANSPORT_try_connect (p1.th, &p2.id); | ||
241 | tct = | ||
242 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &try_connect, | ||
243 | NULL); | ||
244 | } | ||
245 | 222 | ||
223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c, | ||
224 | GNUNET_i2s (&p2->id)); | ||
225 | GNUNET_free (p1_c); | ||
226 | |||
227 | shutdown_flag = GNUNET_NO; | ||
228 | |||
229 | // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG! | ||
230 | timer_task = | ||
231 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10), | ||
232 | &timer, NULL); | ||
233 | } | ||
246 | 234 | ||
247 | static void | 235 | static void |
248 | run (void *cls, char *const *args, const char *cfgfile, | 236 | run (void *cls, char *const *args, const char *cfgfile, |
249 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 237 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
250 | { | 238 | { |
251 | GNUNET_assert (ok == 1); | ||
252 | OKPP; | ||
253 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 239 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
254 | if (is_tcp) | ||
255 | { | ||
256 | setup_peer (&p1, "test_transport_api_multiaddress_tcp_peer1.conf"); | ||
257 | setup_peer (&p2, "test_transport_api_multiaddress_tcp_peer2.conf"); | ||
258 | } | ||
259 | GNUNET_assert (p1.th != NULL); | ||
260 | GNUNET_assert (p2.th != NULL); | ||
261 | 240 | ||
262 | GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); | 241 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p1, ¬ify_receive, |
263 | GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); | 242 | ¬ify_connect, ¬ify_disconnect, |
264 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); | 243 | NULL); |
244 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, ¬ify_receive, | ||
245 | ¬ify_connect, ¬ify_disconnect, | ||
246 | NULL); | ||
247 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, | ||
248 | NULL); | ||
265 | } | 249 | } |
266 | 250 | ||
267 | static int | 251 | static int |
268 | check () | 252 | check () |
269 | { | 253 | { |
270 | static char *const argv[] = { "test-transport-api", | 254 | static char *const argv[] = { "test-transport-api-multiaddress", |
271 | "-c", | 255 | "-c", |
272 | "test_transport_api_data.conf", | 256 | "test_transport_api_data.conf", |
273 | #if VERBOSE | 257 | #if VERBOSE |
@@ -282,26 +266,16 @@ check () | |||
282 | #if WRITECONFIG | 266 | #if WRITECONFIG |
283 | setTransportOptions ("test_transport_api_data.conf"); | 267 | setTransportOptions ("test_transport_api_data.conf"); |
284 | #endif | 268 | #endif |
269 | timer_task = GNUNET_SCHEDULER_NO_TASK; | ||
270 | |||
285 | ok = 1; | 271 | ok = 1; |
286 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 272 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
287 | "test-transport-api", "nohelp", options, &run, &ok); | 273 | "test-transport-api-multiaddress", "nohelp", options, |
288 | stop_arm (&p1); | 274 | &run, &ok); |
289 | stop_arm (&p2); | ||
290 | 275 | ||
291 | if (p1.servicehome != NULL) | ||
292 | { | ||
293 | GNUNET_DISK_directory_remove (p1.servicehome); | ||
294 | GNUNET_free (p1.servicehome); | ||
295 | } | ||
296 | if (p2.servicehome != NULL) | ||
297 | { | ||
298 | GNUNET_DISK_directory_remove (p2.servicehome); | ||
299 | GNUNET_free (p2.servicehome); | ||
300 | } | ||
301 | return ok; | 276 | return ok; |
302 | } | 277 | } |
303 | 278 | ||
304 | |||
305 | int | 279 | int |
306 | main (int argc, char *argv[]) | 280 | main (int argc, char *argv[]) |
307 | { | 281 | { |
@@ -315,13 +289,53 @@ main (int argc, char *argv[]) | |||
315 | #endif | 289 | #endif |
316 | NULL); | 290 | NULL); |
317 | 291 | ||
318 | if (strstr (argv[0], "tcp") != NULL) | 292 | char *pch = strdup (argv[0]); |
293 | char *backup = pch; | ||
294 | char *filename = NULL; | ||
295 | char *dotexe; | ||
296 | int nat_res; | ||
297 | |||
298 | /* get executable filename */ | ||
299 | pch = strtok (pch, "/"); | ||
300 | while (pch != NULL) | ||
319 | { | 301 | { |
320 | is_tcp = GNUNET_YES; | 302 | pch = strtok (NULL, "/"); |
303 | if (pch != NULL) | ||
304 | filename = pch; | ||
321 | } | 305 | } |
306 | /* remove "lt-" */ | ||
307 | filename = strstr (filename, "tes"); | ||
308 | if (NULL != (dotexe = strstr (filename, ".exe"))) | ||
309 | dotexe[0] = '\0'; | ||
310 | |||
311 | /* create cfg filename */ | ||
312 | GNUNET_asprintf (&cfg_file_p1, "%s_peer1.conf", filename); | ||
313 | GNUNET_asprintf (&cfg_file_p2, "%s_peer2.conf", filename); | ||
314 | GNUNET_free (backup); | ||
315 | |||
316 | if ((strstr (argv[0], "tcp_nat") != NULL) || | ||
317 | (strstr (argv[0], "udp_nat") != NULL)) | ||
318 | { | ||
319 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | ||
320 | if (GNUNET_NO == nat_res) | ||
321 | { | ||
322 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", | ||
323 | "gnunet-nat-server", "SUID not set"); | ||
324 | return 0; | ||
325 | } | ||
326 | if (GNUNET_SYSERR == nat_res) | ||
327 | { | ||
328 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", | ||
329 | "gnunet-nat-server", "file not found"); | ||
330 | return 0; | ||
331 | } | ||
322 | 332 | ||
333 | } | ||
323 | ret = check (); | 334 | ret = check (); |
324 | 335 | ||
336 | GNUNET_free (cfg_file_p1); | ||
337 | GNUNET_free (cfg_file_p2); | ||
338 | |||
325 | return ret; | 339 | return ret; |
326 | } | 340 | } |
327 | 341 | ||