diff options
Diffstat (limited to 'src/nat/nat_test.c')
-rw-r--r-- | src/nat/nat_test.c | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index 8a46a96fa..8c9933cdb 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c | |||
@@ -179,8 +179,11 @@ reversal_cb (void *cls, | |||
179 | sa = (const struct sockaddr_in *) addr; | 179 | sa = (const struct sockaddr_in *) addr; |
180 | if (h->data != sa->sin_port) | 180 | if (h->data != sa->sin_port) |
181 | { | 181 | { |
182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 182 | #if DEBUG_NAT |
183 | "Received connection reversal request for wrong port\n"); | 183 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
184 | "nat", | ||
185 | "Received connection reversal request for wrong port\n"); | ||
186 | #endif | ||
184 | return; /* wrong port */ | 187 | return; /* wrong port */ |
185 | } | 188 | } |
186 | /* report success */ | 189 | /* report success */ |
@@ -216,13 +219,19 @@ do_udp_read (void *cls, | |||
216 | { | 219 | { |
217 | if (data == tst->data) | 220 | if (data == tst->data) |
218 | tst->report (tst->report_cls, GNUNET_OK); | 221 | tst->report (tst->report_cls, GNUNET_OK); |
222 | #if DEBUG_NAT | ||
219 | else | 223 | else |
220 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 224 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
221 | "Received data mismatches expected value\n"); | 225 | "nat", |
226 | "Received data mismatches expected value\n"); | ||
227 | #endif | ||
222 | } | 228 | } |
229 | #if DEBUG_NAT | ||
223 | else | 230 | else |
224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 231 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
225 | "Failed to receive data from inbound connection\n"); | 232 | "nat", |
233 | "Failed to receive data from inbound connection\n"); | ||
234 | #endif | ||
226 | } | 235 | } |
227 | 236 | ||
228 | 237 | ||
@@ -256,13 +265,19 @@ do_read (void *cls, | |||
256 | { | 265 | { |
257 | if (data == tst->data) | 266 | if (data == tst->data) |
258 | tst->report (tst->report_cls, GNUNET_OK); | 267 | tst->report (tst->report_cls, GNUNET_OK); |
268 | #if DEBUG_NAT | ||
259 | else | 269 | else |
260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 270 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
261 | "Received data mismatches expected value\n"); | 271 | "nat" |
272 | "Received data mismatches expected value\n"); | ||
273 | #endif | ||
262 | } | 274 | } |
275 | #if DEBUG_NAT | ||
263 | else | 276 | else |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 277 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
265 | "Failed to receive data from inbound connection\n"); | 278 | "nat", |
279 | "Failed to receive data from inbound connection\n"); | ||
280 | #endif | ||
266 | GNUNET_NETWORK_socket_close (na->sock); | 281 | GNUNET_NETWORK_socket_close (na->sock); |
267 | GNUNET_free (na); | 282 | GNUNET_free (na); |
268 | } | 283 | } |
@@ -296,8 +311,11 @@ do_accept (void *cls, | |||
296 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO, "accept"); | 311 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO, "accept"); |
297 | return; /* odd error */ | 312 | return; /* odd error */ |
298 | } | 313 | } |
299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 314 | #if DEBUG_NAT |
300 | "Got an inbound connection, waiting for data\n"); | 315 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
316 | "nat", | ||
317 | "Got an inbound connection, waiting for data\n"); | ||
318 | #endif | ||
301 | wl = GNUNET_malloc (sizeof (struct NatActivity)); | 319 | wl = GNUNET_malloc (sizeof (struct NatActivity)); |
302 | wl->sock = s; | 320 | wl->sock = s; |
303 | wl->h = tst; | 321 | wl->h = tst; |
@@ -336,9 +354,12 @@ addr_cb (void *cls, | |||
336 | return; | 354 | return; |
337 | if (addrlen != sizeof (struct sockaddr_in)) | 355 | if (addrlen != sizeof (struct sockaddr_in)) |
338 | return; /* ignore IPv6 here */ | 356 | return; /* ignore IPv6 here */ |
339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 357 | #if DEBUG_NAT |
340 | "Asking gnunet-nat-server to connect to `%s'\n", | 358 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
341 | GNUNET_a2s (addr, addrlen)); | 359 | "nat", |
360 | "Asking gnunet-nat-server to connect to `%s'\n", | ||
361 | GNUNET_a2s (addr, addrlen)); | ||
362 | #endif | ||
342 | sa = (const struct sockaddr_in*) addr; | 363 | sa = (const struct sockaddr_in*) addr; |
343 | msg.header.size = htons (sizeof(struct GNUNET_NAT_TestMessage)); | 364 | msg.header.size = htons (sizeof(struct GNUNET_NAT_TestMessage)); |
344 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAT_TEST); | 365 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAT_TEST); |