aboutsummaryrefslogtreecommitdiff
path: root/src/nat/gnunet-nat-server.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
commit9fac6b6eefdc9144053f736fd388cb2199a97046 (patch)
tree82740a981b7f6ae973d915aa77797acd9db668b2 /src/nat/gnunet-nat-server.c
parent23d8d343d5c70481ecf78ec4fafc698907f3e8a9 (diff)
downloadgnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.tar.gz
gnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.zip
-removing legacy ifdefs, fixing log statements
Diffstat (limited to 'src/nat/gnunet-nat-server.c')
-rw-r--r--src/nat/gnunet-nat-server.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c
index 0336ecc9d..9b6846cf0 100644
--- a/src/nat/gnunet-nat-server.c
+++ b/src/nat/gnunet-nat-server.c
@@ -55,11 +55,9 @@ try_anat (uint32_t dst_ipv4, uint16_t dport, int is_tcp)
55 struct GNUNET_NAT_Handle *h; 55 struct GNUNET_NAT_Handle *h;
56 struct sockaddr_in sa; 56 struct sockaddr_in sa;
57 57
58#if DEBUG_NAT
59 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 58 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
60 "Asking for connection reversal with %x and code %u\n", 59 "Asking for connection reversal with %x and code %u\n",
61 (unsigned int) dst_ipv4, (unsigned int) dport); 60 (unsigned int) dst_ipv4, (unsigned int) dport);
62#endif
63 h = GNUNET_NAT_register (cfg, is_tcp, dport, 0, NULL, NULL, NULL, NULL, NULL); 61 h = GNUNET_NAT_register (cfg, is_tcp, dport, 0, NULL, NULL, NULL, NULL, NULL);
64 memset (&sa, 0, sizeof (sa)); 62 memset (&sa, 0, sizeof (sa));
65 sa.sin_family = AF_INET; 63 sa.sin_family = AF_INET;
@@ -107,9 +105,7 @@ tcp_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
107 if (-1 == 105 if (-1 ==
108 GNUNET_NETWORK_socket_send (ctx->s, &ctx->data, sizeof (ctx->data))) 106 GNUNET_NETWORK_socket_send (ctx->s, &ctx->data, sizeof (ctx->data)))
109 { 107 {
110#if DEBUG_NAT
111 GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send"); 108 GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send");
112#endif
113 } 109 }
114 GNUNET_NETWORK_socket_shutdown (ctx->s, SHUT_RDWR); 110 GNUNET_NETWORK_socket_shutdown (ctx->s, SHUT_RDWR);
115 } 111 }
@@ -146,10 +142,8 @@ try_send_tcp (uint32_t dst_ipv4, uint16_t dport, uint16_t data)
146#endif 142#endif
147 sa.sin_addr.s_addr = dst_ipv4; 143 sa.sin_addr.s_addr = dst_ipv4;
148 sa.sin_port = htons (dport); 144 sa.sin_port = htons (dport);
149#if DEBUG_NAT
150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TCP message to `%s'\n", 145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TCP message to `%s'\n",
151 GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa))); 146 GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa)));
152#endif
153 if ((GNUNET_OK != 147 if ((GNUNET_OK !=
154 GNUNET_NETWORK_socket_connect (s, (const struct sockaddr *) &sa, 148 GNUNET_NETWORK_socket_connect (s, (const struct sockaddr *) &sa,
155 sizeof (sa))) && (errno != EINPROGRESS)) 149 sizeof (sa))) && (errno != EINPROGRESS))
@@ -192,10 +186,8 @@ try_send_udp (uint32_t dst_ipv4, uint16_t dport, uint16_t data)
192#endif 186#endif
193 sa.sin_addr.s_addr = dst_ipv4; 187 sa.sin_addr.s_addr = dst_ipv4;
194 sa.sin_port = htons (dport); 188 sa.sin_port = htons (dport);
195#if DEBUG_NAT
196 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending UDP packet to `%s'\n", 189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending UDP packet to `%s'\n",
197 GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa))); 190 GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa)));
198#endif
199 if (-1 == 191 if (-1 ==
200 GNUNET_NETWORK_socket_sendto (s, &data, sizeof (data), 192 GNUNET_NETWORK_socket_sendto (s, &data, sizeof (data),
201 (const struct sockaddr *) &sa, sizeof (sa))) 193 (const struct sockaddr *) &sa, sizeof (sa)))
@@ -219,9 +211,7 @@ test (void *cls, struct GNUNET_SERVER_Client *client,
219 const struct GNUNET_NAT_TestMessage *tm; 211 const struct GNUNET_NAT_TestMessage *tm;
220 uint16_t dport; 212 uint16_t dport;
221 213
222#if DEBUG_NAT
223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received test request\n"); 214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received test request\n");
224#endif
225 tm = (const struct GNUNET_NAT_TestMessage *) msg; 215 tm = (const struct GNUNET_NAT_TestMessage *) msg;
226 dport = ntohs (tm->dport); 216 dport = ntohs (tm->dport);
227 if (0 == dport) 217 if (0 == dport)