From 1b97726713d88e1ec485aa1e827365a707ebc02f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 24 Jan 2011 11:13:39 +0000 Subject: do not try TCP if port is 0 --- src/util/client.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/client.c b/src/util/client.c index d957dd00a..ed554d96c 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -253,6 +253,7 @@ struct GNUNET_CLIENT_Connection }; + /** * Try to connect to the service. * @@ -272,7 +273,7 @@ do_connect (const char *service_name, unsigned long long port; #if AF_UNIX - if (0 == attempt % 2) + if (0 == (attempt % 2)) { /* on even rounds, try UNIX */ if (GNUNET_OK == @@ -314,6 +315,27 @@ do_connect (const char *service_name, service_name); return NULL; } + if (port == 0) + { +#if AF_UNIX + if (0 != (attempt % 2)) + { + /* try UNIX */ + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (cfg, + service_name, + "UNIXPATH", &unixpath)) + { + sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, + unixpath); + GNUNET_free (unixpath); + if (sock != NULL) + return sock; + } + } +#endif + return NULL; + } sock = GNUNET_CONNECTION_create_from_connect (cfg, hostname, port); -- cgit v1.2.3