summaryrefslogtreecommitdiff
path: root/src/util/client.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-24 11:13:39 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-24 11:13:39 +0000
commit1b97726713d88e1ec485aa1e827365a707ebc02f (patch)
tree2b8b6c9713db6f9326208d74ea3940b0a690d947 /src/util/client.c
parent529055038874c97055e554f83b2fcd8f4f7f0dab (diff)
do not try TCP if port is 0
Diffstat (limited to 'src/util/client.c')
-rw-r--r--src/util/client.c24
1 files changed, 23 insertions, 1 deletions
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);