projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
proper shutdown
[oweals/gnunet.git]
/
src
/
util
/
client.c
diff --git
a/src/util/client.c
b/src/util/client.c
index 257a69b5a82e8c25bdd8e64073797c5d79658b7d..7e688059044211cebf40dcea045f51534252b4a0 100644
(file)
--- a/
src/util/client.c
+++ b/
src/util/client.c
@@
-43,7
+43,6
@@
*/
#define MAX_ATTEMPTS 50
*/
#define MAX_ATTEMPTS 50
-
/**
* Handle for a transmission request.
*/
/**
* Handle for a transmission request.
*/
@@
-272,6
+271,7
@@
do_connect (const char *service_name,
char *unixpath;
unsigned long long port;
char *unixpath;
unsigned long long port;
+ sock = NULL;
#if AF_UNIX
if (0 == (attempt % 2))
{
#if AF_UNIX
if (0 == (attempt % 2))
{
@@
-280,14
+280,19
@@
do_connect (const char *service_name,
GNUNET_CONFIGURATION_get_value_string (cfg,
service_name,
"UNIXPATH", &unixpath)) &&
GNUNET_CONFIGURATION_get_value_string (cfg,
service_name,
"UNIXPATH", &unixpath)) &&
- (0 < strlen (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)
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
}
#endif
@@
-303,8
+308,7
@@
do_connect (const char *service_name,
"HOSTNAME", &hostname)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"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;
}
service_name);
return NULL;
}
@@
-332,12
+336,19
@@
do_connect (const char *service_name,
unixpath);
GNUNET_free (unixpath);
if (sock != NULL)
unixpath);
GNUNET_free (unixpath);
if (sock != NULL)
- return sock;
+ return sock;
}
}
#endif
}
}
#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;
}
return NULL;
}
+
sock = GNUNET_CONNECTION_create_from_connect (cfg,
hostname,
port);
sock = GNUNET_CONNECTION_create_from_connect (cfg,
hostname,
port);
@@
-480,6
+491,9
@@
receive_helper (void *cls,
if ((available == 0) || (conn->sock == NULL) || (errCode != 0))
{
/* signal timeout! */
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;
if (NULL != (receive_handler = conn->receiver_handler))
{
receive_handler_cls = conn->receiver_handler_cls;
@@
-586,6
+600,9
@@
GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock,
{
GNUNET_assert (sock->in_receive == GNUNET_NO);
sock->in_receive = GNUNET_YES;
{
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);
GNUNET_CONNECTION_receive (sock->sock,
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
timeout, &receive_helper, sock);