X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fclient.c;h=7e688059044211cebf40dcea045f51534252b4a0;hb=bb83cd2d04ff5a3f7a8d05fc9a724b0246e958b6;hp=a097086d36074a5829203ce659f279ea5ec0b819;hpb=58e5ef6d095284050a9e0f9d79ac8008c2fab714;p=oweals%2Fgnunet.git diff --git a/src/util/client.c b/src/util/client.c index a097086d3..7e6880590 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -43,9 +43,6 @@ */ #define MAX_ATTEMPTS 50 -#define UNIXPATH_RETRIES 0 - - /** * Handle for a transmission request. */ @@ -273,7 +270,6 @@ do_connect (const char *service_name, char *hostname; char *unixpath; unsigned long long port; - unsigned int count; sock = NULL; #if AF_UNIX @@ -286,27 +282,17 @@ do_connect (const char *service_name, "UNIXPATH", &unixpath)) && (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */ { - count = 0; sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath); - while ((NULL == sock) && (count < UNIXPATH_RETRIES)) - { -#if DEBUG_CLIENT - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Failed to connect to unixpath `%s', retrying!\n", unixpath); -#endif - count++; - sleep(1); - sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath); - } - - GNUNET_free (unixpath); if (sock != NULL) { #if DEBUG_CLIENT GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connected to unixpath `%s'!\n", unixpath); #endif + GNUNET_free(unixpath); return sock; } } + GNUNET_free_non_null (unixpath); } #endif @@ -322,8 +308,7 @@ do_connect (const char *service_name, "HOSTNAME", &hostname))) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _ - ("Could not determine valid hostname and port for service `%s' from configuration.\n"), + _("Could not determine valid hostname and port for service `%s' from configuration.\n"), service_name); return NULL; } @@ -351,16 +336,19 @@ do_connect (const char *service_name, unixpath); GNUNET_free (unixpath); if (sock != NULL) - { - return sock; - } + return sock; } } #endif - GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Port is 0 for service `%s', unixpath didn't work, returning NULL(!)!\n", service_name); +#if DEBUG_CLIENT + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Port is 0 for service `%s', UNIXPATH did not work, returning NULL!\n", + service_name); +#endif + GNUNET_free (hostname); return NULL; } - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating from connect!\n"); + sock = GNUNET_CONNECTION_create_from_connect (cfg, hostname, port);