[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15926 - gnunet/src/nat
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15926 - gnunet/src/nat |
Date: |
Mon, 11 Jul 2011 16:49:46 +0200 |
Author: grothoff
Date: 2011-07-11 16:49:46 +0200 (Mon, 11 Jul 2011)
New Revision: 15926
Modified:
gnunet/src/nat/nat.c
gnunet/src/nat/nat_mini.c
gnunet/src/nat/nat_test.c
gnunet/src/nat/test_nat.c
gnunet/src/nat/test_nat_mini.c
gnunet/src/nat/test_nat_test.c
Log:
logging
Modified: gnunet/src/nat/nat.c
===================================================================
--- gnunet/src/nat/nat.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/nat.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -24,15 +24,14 @@
* external IP address retrieval
* @author Milan Bouchet-Valat
* @author Christian Grothoff
- *
- * TODO:
- * - implement UPnP/PMP support
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_resolver_service.h"
#include "gnunet_nat_lib.h"
+#define DEBUG_NAT GNUNET_NO
+
/**
* How often do we scan for changes in our IP address from our local
* interfaces?
@@ -767,7 +766,7 @@
sizeof(mybuf));
if (bytes < 1)
{
-#if DEBUG_TCP_NAT
+#if DEBUG_NAT
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"nat",
"Finished reading from server stdout with code: %d\n",
@@ -1136,10 +1135,13 @@
struct in_addr in_addr;
unsigned int i;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Registered with NAT service at port %u with %u IP bound local
addresses\n",
- (unsigned int) adv_port,
- num_addrs);
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Registered with NAT service at port %u with %u IP bound
local addresses\n",
+ (unsigned int) adv_port,
+ num_addrs);
+#endif
h = GNUNET_malloc (sizeof (struct GNUNET_NAT_Handle));
h->server_retry_delay = GNUNET_TIME_UNIT_SECONDS;
h->cfg = cfg;
@@ -1432,7 +1434,7 @@
sizeof (port_as_string),
"%d",
h->adv_port);
-#if DEBUG_TCP_NAT
+#if DEBUG_NAT
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"nat",
_("Running gnunet-helper-nat-client %s %s %u\n"),
Modified: gnunet/src/nat/nat_mini.c
===================================================================
--- gnunet/src/nat/nat_mini.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/nat_mini.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -28,6 +28,8 @@
#include "gnunet_nat_lib.h"
#include "nat.h"
+#define DEBUG_NAT GNUNET_NO
+
/**
* How long do we give upnpc to create a mapping?
*/
@@ -453,8 +455,11 @@
if (NULL == line)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "UPnP unmap done\n");
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "UPnP unmap done\n");
+#endif
GNUNET_OS_command_stop (mini->unmap_cmd);
mini->unmap_cmd = NULL;
GNUNET_free (mini);
@@ -506,9 +511,12 @@
GNUNET_snprintf (pstr, sizeof (pstr),
"%u",
(unsigned int) ntohs (mini->current_addr.sin_port));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Unmapping port %u\n",
- ntohs (mini->current_addr.sin_port));
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Unmapping port %u with UPnP\n",
+ ntohs (mini->current_addr.sin_port));
+#endif
mini->unmap_cmd = GNUNET_OS_command_run (&process_unmap_output,
mini,
UNMAP_TIMEOUT,
Modified: gnunet/src/nat/nat_test.c
===================================================================
--- gnunet/src/nat/nat_test.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/nat_test.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -179,8 +179,11 @@
sa = (const struct sockaddr_in *) addr;
if (h->data != sa->sin_port)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received connection reversal request for wrong port\n");
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Received connection reversal request for wrong port\n");
+#endif
return; /* wrong port */
}
/* report success */
@@ -216,13 +219,19 @@
{
if (data == tst->data)
tst->report (tst->report_cls, GNUNET_OK);
+#if DEBUG_NAT
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received data mismatches expected value\n");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Received data mismatches expected value\n");
+#endif
}
+#if DEBUG_NAT
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to receive data from inbound connection\n");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Failed to receive data from inbound connection\n");
+#endif
}
@@ -256,13 +265,19 @@
{
if (data == tst->data)
tst->report (tst->report_cls, GNUNET_OK);
+#if DEBUG_NAT
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received data mismatches expected value\n");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat"
+ "Received data mismatches expected value\n");
+#endif
}
+#if DEBUG_NAT
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed to receive data from inbound connection\n");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Failed to receive data from inbound connection\n");
+#endif
GNUNET_NETWORK_socket_close (na->sock);
GNUNET_free (na);
}
@@ -296,8 +311,11 @@
GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO, "accept");
return; /* odd error */
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got an inbound connection, waiting for data\n");
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Got an inbound connection, waiting for data\n");
+#endif
wl = GNUNET_malloc (sizeof (struct NatActivity));
wl->sock = s;
wl->h = tst;
@@ -336,9 +354,12 @@
return;
if (addrlen != sizeof (struct sockaddr_in))
return; /* ignore IPv6 here */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asking gnunet-nat-server to connect to `%s'\n",
- GNUNET_a2s (addr, addrlen));
+#if DEBUG_NAT
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "nat",
+ "Asking gnunet-nat-server to connect to `%s'\n",
+ GNUNET_a2s (addr, addrlen));
+#endif
sa = (const struct sockaddr_in*) addr;
msg.header.size = htons (sizeof(struct GNUNET_NAT_TestMessage));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAT_TEST);
Modified: gnunet/src/nat/test_nat.c
===================================================================
--- gnunet/src/nat/test_nat.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/test_nat.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -41,11 +41,13 @@
#include "gnunet_nat_lib.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
-/* Time to wait before stopping NAT, in seconds */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+/**
+ * Time to wait before stopping NAT, in seconds
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
/**
Modified: gnunet/src/nat/test_nat_mini.c
===================================================================
--- gnunet/src/nat/test_nat_mini.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/test_nat_mini.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -36,7 +36,7 @@
#include "gnunet_nat_lib.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
/* Time to wait before stopping NAT, in seconds */
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
Modified: gnunet/src/nat/test_nat_test.c
===================================================================
--- gnunet/src/nat/test_nat_test.c 2011-07-11 14:35:44 UTC (rev 15925)
+++ gnunet/src/nat/test_nat_test.c 2011-07-11 14:49:46 UTC (rev 15926)
@@ -31,7 +31,7 @@
#include "gnunet_nat_lib.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15926 - gnunet/src/nat,
gnunet <=