summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-15 12:49:34 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-15 12:49:34 +0000
commit653905eb0e2ada9c3c5832d7e1a36c71f8b9f02e (patch)
tree0b2d1b74c6ba0f2fb1b5344030c82296fc61e830
parent28e98f6bae3d2bef1c3962a2b6bf370db7feb15d (diff)
-do not call NAT with zero addresses
-rw-r--r--src/transport/plugin_transport_tcp.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 986eb4ef8..d518882ba 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2374,26 +2374,21 @@ libgnunet_plugin_transport_tcp_init (void *cls)
plugin->lsock = NULL;
if ((service != NULL) &&
(GNUNET_SYSERR !=
- (ret =
+ (ret_s =
GNUNET_SERVICE_get_server_addresses ("transport-tcp", env->cfg, &addrs,
&addrlens))))
{
- ret_s = ret;
- while (ret > 0)
- {
- ret--;
- LOG (GNUNET_ERROR_TYPE_INFO, "Binding to address `%s'\n", GNUNET_a2s (addrs[ret], addrlens[ret]));
- }
-
+ for (ret = ret_s-1; ret >= 0; ret--)
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "Binding to address `%s'\n",
+ GNUNET_a2s (addrs[ret], addrlens[ret]));
plugin->nat =
- GNUNET_NAT_register (env->cfg, GNUNET_YES, aport, (unsigned int) ret,
+ GNUNET_NAT_register (env->cfg, GNUNET_YES, aport, (unsigned int) ret_s,
(const struct sockaddr **) addrs, addrlens,
&tcp_nat_port_map_callback,
&try_connection_reversal, plugin);
- ret = ret_s;
- while (ret > 0)
+ for (ret = ret_s -1; ret >= 0; ret--)
{
- ret--;
GNUNET_assert (addrs[ret] != NULL);
GNUNET_free (addrs[ret]);
}
@@ -2403,8 +2398,8 @@ libgnunet_plugin_transport_tcp_init (void *cls)
else
{
plugin->nat = GNUNET_NAT_register (plugin->env->cfg,
- GNUNET_YES, 0, 0, NULL, NULL, NULL,
- &try_connection_reversal, plugin);
+ GNUNET_YES, 0, 0, NULL, NULL, NULL,
+ &try_connection_reversal, plugin);
}
api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
api->cls = plugin;