diff options
Diffstat (limited to 'src/util/service.c')
-rw-r--r-- | src/util/service.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/util/service.c b/src/util/service.c index fcdf45a51..1156093f4 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1932,6 +1932,11 @@ do_send (void *cls) | |||
1932 | size_t left; | 1932 | size_t left; |
1933 | const char *buf; | 1933 | const char *buf; |
1934 | 1934 | ||
1935 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1936 | "service: sending message with type %u", | ||
1937 | ntohs(client->msg->type)); | ||
1938 | |||
1939 | |||
1935 | client->send_task = NULL; | 1940 | client->send_task = NULL; |
1936 | buf = (const char *) client->msg; | 1941 | buf = (const char *) client->msg; |
1937 | left = ntohs (client->msg->size) - client->msg_pos; | 1942 | left = ntohs (client->msg->size) - client->msg_pos; |
@@ -1941,6 +1946,8 @@ do_send (void *cls) | |||
1941 | GNUNET_assert (ret <= (ssize_t) left); | 1946 | GNUNET_assert (ret <= (ssize_t) left); |
1942 | if (0 == ret) | 1947 | if (0 == ret) |
1943 | { | 1948 | { |
1949 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1950 | "no data send"); | ||
1944 | GNUNET_MQ_inject_error (client->mq, | 1951 | GNUNET_MQ_inject_error (client->mq, |
1945 | GNUNET_MQ_ERROR_WRITE); | 1952 | GNUNET_MQ_ERROR_WRITE); |
1946 | return; | 1953 | return; |
@@ -1958,6 +1965,9 @@ do_send (void *cls) | |||
1958 | if (EPIPE != errno) | 1965 | if (EPIPE != errno) |
1959 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, | 1966 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, |
1960 | "send"); | 1967 | "send"); |
1968 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1969 | "socket send returned with error code %i", | ||
1970 | errno); | ||
1961 | GNUNET_MQ_inject_error (client->mq, | 1971 | GNUNET_MQ_inject_error (client->mq, |
1962 | GNUNET_MQ_ERROR_WRITE); | 1972 | GNUNET_MQ_ERROR_WRITE); |
1963 | return; | 1973 | return; |
@@ -1968,7 +1978,7 @@ do_send (void *cls) | |||
1968 | GNUNET_MQ_impl_send_in_flight (client->mq); | 1978 | GNUNET_MQ_impl_send_in_flight (client->mq); |
1969 | } | 1979 | } |
1970 | client->msg_pos += ret; | 1980 | client->msg_pos += ret; |
1971 | if (left > ret) | 1981 | if (left > (size_t) ret) |
1972 | { | 1982 | { |
1973 | GNUNET_assert (NULL == client->drop_task); | 1983 | GNUNET_assert (NULL == client->drop_task); |
1974 | client->send_task | 1984 | client->send_task |
@@ -1997,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq, | |||
1997 | { | 2007 | { |
1998 | struct GNUNET_SERVICE_Client *client = impl_state; | 2008 | struct GNUNET_SERVICE_Client *client = impl_state; |
1999 | 2009 | ||
2010 | (void) mq; | ||
2000 | if (NULL != client->drop_task) | 2011 | if (NULL != client->drop_task) |
2001 | return; /* we're going down right now, do not try to send */ | 2012 | return; /* we're going down right now, do not try to send */ |
2002 | GNUNET_assert (NULL == client->send_task); | 2013 | GNUNET_assert (NULL == client->send_task); |
@@ -2026,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, | |||
2026 | { | 2037 | { |
2027 | struct GNUNET_SERVICE_Client *client = impl_state; | 2038 | struct GNUNET_SERVICE_Client *client = impl_state; |
2028 | 2039 | ||
2040 | (void) mq; | ||
2029 | GNUNET_assert (0 == client->msg_pos); | 2041 | GNUNET_assert (0 == client->msg_pos); |
2030 | client->msg = NULL; | 2042 | client->msg = NULL; |
2031 | GNUNET_SCHEDULER_cancel (client->send_task); | 2043 | GNUNET_SCHEDULER_cancel (client->send_task); |
@@ -2402,7 +2414,7 @@ resume_client_receive (void *cls) | |||
2402 | GNUNET_YES); | 2414 | GNUNET_YES); |
2403 | if (GNUNET_SYSERR == ret) | 2415 | if (GNUNET_SYSERR == ret) |
2404 | { | 2416 | { |
2405 | if (NULL != c->drop_task) | 2417 | if (NULL == c->drop_task) |
2406 | GNUNET_SERVICE_client_drop (c); | 2418 | GNUNET_SERVICE_client_drop (c); |
2407 | return; | 2419 | return; |
2408 | } | 2420 | } |
@@ -2431,6 +2443,7 @@ resume_client_receive (void *cls) | |||
2431 | void | 2443 | void |
2432 | GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c) | 2444 | GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c) |
2433 | { | 2445 | { |
2446 | GNUNET_assert (NULL == c->drop_task); | ||
2434 | GNUNET_assert (GNUNET_YES == c->needs_continue); | 2447 | GNUNET_assert (GNUNET_YES == c->needs_continue); |
2435 | GNUNET_assert (NULL == c->recv_task); | 2448 | GNUNET_assert (NULL == c->recv_task); |
2436 | c->needs_continue = GNUNET_NO; | 2449 | c->needs_continue = GNUNET_NO; |
@@ -2513,6 +2526,24 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c) | |||
2513 | { | 2526 | { |
2514 | struct GNUNET_SERVICE_Handle *sh = c->sh; | 2527 | struct GNUNET_SERVICE_Handle *sh = c->sh; |
2515 | 2528 | ||
2529 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2530 | "Client dropped: %p (MQ: %p)\n", | ||
2531 | c, | ||
2532 | c->mq); | ||
2533 | |||
2534 | #if EXECINFO | ||
2535 | void *backtrace_array[MAX_TRACE_DEPTH]; | ||
2536 | int num_backtrace_strings = backtrace (backtrace_array, MAX_TRACE_DEPTH); | ||
2537 | char **backtrace_strings = | ||
2538 | backtrace_symbols (backtrace_array, | ||
2539 | t->num_backtrace_strings); | ||
2540 | for (unsigned int i = 0; i < num_backtrace_strings; i++) | ||
2541 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2542 | "client drop trace %u: %s\n", | ||
2543 | i, | ||
2544 | backtrace_strings[i]); | ||
2545 | #endif | ||
2546 | |||
2516 | if (NULL != c->drop_task) | 2547 | if (NULL != c->drop_task) |
2517 | { | 2548 | { |
2518 | /* asked to drop twice! */ | 2549 | /* asked to drop twice! */ |