*/
#define MAX_ATTEMPTS 50
-
/**
* Handle for a transmission request.
*/
char *unixpath;
unsigned long long port;
+ sock = NULL;
#if AF_UNIX
if (0 == (attempt % 2))
{
/* on even rounds, try UNIX */
- if (GNUNET_OK ==
+ if ((GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg,
service_name,
- "UNIXPATH", &unixpath))
+ "UNIXPATH", &unixpath)) &&
+ (0 < strlen (unixpath))) /* We have a non-NULL unixpath, does that mean it's valid? */
{
- sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg,
- unixpath);
- GNUNET_free (unixpath);
+ sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath);
if (sock != NULL)
- return sock;
+ {
+#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
"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;
}
if (0 != (attempt % 2))
{
/* try UNIX */
- if (GNUNET_OK ==
+ if ((GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg,
service_name,
- "UNIXPATH", &unixpath))
+ "UNIXPATH", &unixpath)) &&
+ (0 < strlen (unixpath)))
{
sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg,
unixpath);
GNUNET_free (unixpath);
if (sock != NULL)
- return sock;
+ return sock;
}
}
#endif
+#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;
}
+
sock = GNUNET_CONNECTION_create_from_connect (cfg,
hostname,
port);
if ((available == 0) || (conn->sock == NULL) || (errCode != 0))
{
/* signal timeout! */
+#if DEBUG_CLIENT
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "timeout in receive_helper, available %d, conn->sock %s, errCode %d\n", available, conn->sock == NULL ? "NULL" : "non-NULL", errCode);
+#endif
if (NULL != (receive_handler = conn->receiver_handler))
{
receive_handler_cls = conn->receiver_handler_cls;
{
GNUNET_assert (sock->in_receive == GNUNET_NO);
sock->in_receive = GNUNET_YES;
+#if DEBUG_CLIENT
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "calling GNUNET_CONNECTION_receive\n");
+#endif
GNUNET_CONNECTION_receive (sock->sock,
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
timeout, &receive_helper, sock);