diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-13 17:04:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-13 17:04:35 +0000 |
commit | f491ac4fab469421986f77df0bbf79fefc417786 (patch) | |
tree | 1a99677ca3fc3489d6a0dd91443cc9a83bfcea74 /src/util/client.c | |
parent | 85f65a86a9ea908907a89ce7862768b90ca9d084 (diff) | |
download | gnunet-f491ac4fab469421986f77df0bbf79fefc417786.tar.gz gnunet-f491ac4fab469421986f77df0bbf79fefc417786.zip |
change default configurations on systems with UNIX domain sockets to NOT specify any port for TCP-based IPC (and interpret that as no TCP-based IPC desired), as we can and want to use UNIX domain sockets in this case by default
Diffstat (limited to 'src/util/client.c')
-rw-r--r-- | src/util/client.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/util/client.c b/src/util/client.c index e71ccdf39..2f09a9046 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -289,25 +289,35 @@ do_connect (const char *service_name, | |||
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | 291 | ||
292 | if ((GNUNET_OK != | 292 | if (GNUNET_YES == |
293 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) | 293 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) |
294 | || (port > 65535) || | ||
295 | (GNUNET_OK != | ||
296 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", | ||
297 | &hostname))) | ||
298 | { | 294 | { |
299 | LOG (GNUNET_ERROR_TYPE_WARNING, | 295 | if ((GNUNET_OK != |
300 | _ | 296 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) |
301 | ("Could not determine valid hostname and port for service `%s' from configuration.\n"), | 297 | || (port > 65535) || |
302 | service_name); | 298 | (GNUNET_OK != |
303 | return NULL; | 299 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", |
300 | &hostname))) | ||
301 | { | ||
302 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
303 | _ | ||
304 | ("Could not determine valid hostname and port for service `%s' from configuration.\n"), | ||
305 | service_name); | ||
306 | return NULL; | ||
307 | } | ||
308 | if (0 == strlen (hostname)) | ||
309 | { | ||
310 | GNUNET_free (hostname); | ||
311 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
312 | _("Need a non-empty hostname for service `%s'.\n"), service_name); | ||
313 | return NULL; | ||
314 | } | ||
304 | } | 315 | } |
305 | if (0 == strlen (hostname)) | 316 | else |
306 | { | 317 | { |
307 | GNUNET_free (hostname); | 318 | /* unspecified means 0 (disabled) */ |
308 | LOG (GNUNET_ERROR_TYPE_WARNING, | 319 | port = 0; |
309 | _("Need a non-empty hostname for service `%s'.\n"), service_name); | 320 | hostname = NULL; |
310 | return NULL; | ||
311 | } | 321 | } |
312 | if (port == 0) | 322 | if (port == 0) |
313 | { | 323 | { |
@@ -326,7 +336,7 @@ do_connect (const char *service_name, | |||
326 | if (sock != NULL) | 336 | if (sock != NULL) |
327 | { | 337 | { |
328 | GNUNET_free (unixpath); | 338 | GNUNET_free (unixpath); |
329 | GNUNET_free (hostname); | 339 | GNUNET_free_non_null (hostname); |
330 | return sock; | 340 | return sock; |
331 | } | 341 | } |
332 | } | 342 | } |
@@ -338,7 +348,7 @@ do_connect (const char *service_name, | |||
338 | "Port is 0 for service `%s', UNIXPATH did not work, returning NULL!\n", | 348 | "Port is 0 for service `%s', UNIXPATH did not work, returning NULL!\n", |
339 | service_name); | 349 | service_name); |
340 | #endif | 350 | #endif |
341 | GNUNET_free (hostname); | 351 | GNUNET_free_non_null (hostname); |
342 | return NULL; | 352 | return NULL; |
343 | } | 353 | } |
344 | 354 | ||