aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat_test.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-10 13:57:17 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-10 13:57:17 +0000
commit64f93505159d734411000a3097650e8d472c1d9b (patch)
treeb943c59c47cc3935b3c8e377221fe3a79f709dcd /src/nat/nat_test.c
parent2d32b2ca9b0497490e4215a2c15d236b16a77f19 (diff)
downloadgnunet-64f93505159d734411000a3097650e8d472c1d9b.tar.gz
gnunet-64f93505159d734411000a3097650e8d472c1d9b.zip
use LOG macro in nat.c
Diffstat (limited to 'src/nat/nat_test.c')
-rw-r--r--src/nat/nat_test.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
index a524831e4..b6e2a744c 100644
--- a/src/nat/nat_test.c
+++ b/src/nat/nat_test.c
@@ -28,6 +28,7 @@
28#include "gnunet_nat_lib.h" 28#include "gnunet_nat_lib.h"
29#include "nat.h" 29#include "nat.h"
30 30
31#define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__)
31 32
32/** 33/**
33 * Entry we keep for each incoming connection. 34 * Entry we keep for each incoming connection.
@@ -178,8 +179,8 @@ reversal_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen)
178 if (h->data != sa->sin_port) 179 if (h->data != sa->sin_port)
179 { 180 {
180#if DEBUG_NAT 181#if DEBUG_NAT
181 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 182 LOG (GNUNET_ERROR_TYPE_DEBUG,
182 "Received connection reversal request for wrong port\n"); 183 "Received connection reversal request for wrong port\n");
183#endif 184#endif
184 return; /* wrong port */ 185 return; /* wrong port */
185 } 186 }
@@ -213,14 +214,14 @@ do_udp_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
213 tst->report (tst->report_cls, GNUNET_OK); 214 tst->report (tst->report_cls, GNUNET_OK);
214#if DEBUG_NAT 215#if DEBUG_NAT
215 else 216 else
216 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 217 LOG (GNUNET_ERROR_TYPE_DEBUG,
217 "Received data mismatches expected value\n"); 218 "Received data mismatches expected value\n");
218#endif 219#endif
219 } 220 }
220#if DEBUG_NAT 221#if DEBUG_NAT
221 else 222 else
222 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 223 LOG (GNUNET_ERROR_TYPE_DEBUG,
223 "Failed to receive data from inbound connection\n"); 224 "Failed to receive data from inbound connection\n");
224#endif 225#endif
225} 226}
226 227
@@ -251,15 +252,14 @@ do_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
251 tst->report (tst->report_cls, GNUNET_OK); 252 tst->report (tst->report_cls, GNUNET_OK);
252#if DEBUG_NAT 253#if DEBUG_NAT
253 else 254 else
254 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 255 LOG (GNUNET_ERROR_TYPE_DEBUG,
255 "nat", 256 "Received data mismatches expected value\n");
256 "Received data mismatches expected value\n");
257#endif 257#endif
258 } 258 }
259#if DEBUG_NAT 259#if DEBUG_NAT
260 else 260 else
261 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 261 LOG (GNUNET_ERROR_TYPE_DEBUG,
262 "Failed to receive data from inbound connection\n"); 262 "Failed to receive data from inbound connection\n");
263#endif 263#endif
264 GNUNET_NETWORK_socket_close (na->sock); 264 GNUNET_NETWORK_socket_close (na->sock);
265 GNUNET_free (na); 265 GNUNET_free (na);
@@ -293,8 +293,8 @@ do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
293 return; /* odd error */ 293 return; /* odd error */
294 } 294 }
295#if DEBUG_NAT 295#if DEBUG_NAT
296 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 296 LOG (GNUNET_ERROR_TYPE_DEBUG,
297 "Got an inbound connection, waiting for data\n"); 297 "Got an inbound connection, waiting for data\n");
298#endif 298#endif
299 wl = GNUNET_malloc (sizeof (struct NatActivity)); 299 wl = GNUNET_malloc (sizeof (struct NatActivity));
300 wl->sock = s; 300 wl->sock = s;
@@ -330,9 +330,8 @@ addr_cb (void *cls, int add_remove, const struct sockaddr *addr,
330 if (addrlen != sizeof (struct sockaddr_in)) 330 if (addrlen != sizeof (struct sockaddr_in))
331 return; /* ignore IPv6 here */ 331 return; /* ignore IPv6 here */
332#if DEBUG_NAT 332#if DEBUG_NAT
333 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "nat", 333 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asking gnunet-nat-server to connect to `%s'\n",
334 "Asking gnunet-nat-server to connect to `%s'\n", 334 GNUNET_a2s (addr, addrlen));
335 GNUNET_a2s (addr, addrlen));
336#endif 335#endif
337 sa = (const struct sockaddr_in *) addr; 336 sa = (const struct sockaddr_in *) addr;
338 msg.header.size = htons (sizeof (struct GNUNET_NAT_TestMessage)); 337 msg.header.size = htons (sizeof (struct GNUNET_NAT_TestMessage));