diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-01-24 11:13:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-01-24 11:13:39 +0000 |
commit | 1b97726713d88e1ec485aa1e827365a707ebc02f (patch) | |
tree | 2b8b6c9713db6f9326208d74ea3940b0a690d947 | |
parent | 529055038874c97055e554f83b2fcd8f4f7f0dab (diff) | |
download | gnunet-1b97726713d88e1ec485aa1e827365a707ebc02f.tar.gz gnunet-1b97726713d88e1ec485aa1e827365a707ebc02f.zip |
do not try TCP if port is 0
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | src/util/client.c | 24 |
2 files changed, 26 insertions, 1 deletions
@@ -7,6 +7,9 @@ | |||
7 | + implement UDP, HTTP/HTTPS | 7 | + implement UDP, HTTP/HTTPS |
8 | * Transport: | 8 | * Transport: |
9 | - UDP fragmentation | 9 | - UDP fragmentation |
10 | * UTIL / FS: | ||
11 | - gnunet-publish tires to connect to service even if | ||
12 | run with 'simulation' option (-s) | ||
10 | * DHT: [Nate] | 13 | * DHT: [Nate] |
11 | - track paths content travels (PUT, reply-to-get) in messages, | 14 | - track paths content travels (PUT, reply-to-get) in messages, |
12 | pass to client (client API & protocol already support this!) | 15 | pass to client (client API & protocol already support this!) |
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); |