aboutsummaryrefslogtreecommitdiff
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)
downloadgnunet-1b97726713d88e1ec485aa1e827365a707ebc02f.tar.gz
gnunet-1b97726713d88e1ec485aa1e827365a707ebc02f.zip
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
253 253
254}; 254};
255 255
256
256/** 257/**
257 * Try to connect to the service. 258 * Try to connect to the service.
258 * 259 *
@@ -272,7 +273,7 @@ do_connect (const char *service_name,
272 unsigned long long port; 273 unsigned long long port;
273 274
274#if AF_UNIX 275#if AF_UNIX
275 if (0 == attempt % 2) 276 if (0 == (attempt % 2))
276 { 277 {
277 /* on even rounds, try UNIX */ 278 /* on even rounds, try UNIX */
278 if (GNUNET_OK == 279 if (GNUNET_OK ==
@@ -314,6 +315,27 @@ do_connect (const char *service_name,
314 service_name); 315 service_name);
315 return NULL; 316 return NULL;
316 } 317 }
318 if (port == 0)
319 {
320#if AF_UNIX
321 if (0 != (attempt % 2))
322 {
323 /* try UNIX */
324 if (GNUNET_OK ==
325 GNUNET_CONFIGURATION_get_value_string (cfg,
326 service_name,
327 "UNIXPATH", &unixpath))
328 {
329 sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg,
330 unixpath);
331 GNUNET_free (unixpath);
332 if (sock != NULL)
333 return sock;
334 }
335 }
336#endif
337 return NULL;
338 }
317 sock = GNUNET_CONNECTION_create_from_connect (cfg, 339 sock = GNUNET_CONNECTION_create_from_connect (cfg,
318 hostname, 340 hostname,
319 port); 341 port);