fix misc compiler warnings
[oweals/gnunet.git] / src / util / service.c
index 10dc93fafe5257d82b151c712069bc1d3314c6c8..1156093f4c4cce6e136e469d1187e2c6dda2c6fb 100644 (file)
@@ -1932,6 +1932,11 @@ do_send (void *cls)
   size_t left;
   const char *buf;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "service: sending message with type %u",
+       ntohs(client->msg->type));
+
+
   client->send_task = NULL;
   buf = (const char *) client->msg;
   left = ntohs (client->msg->size) - client->msg_pos;
@@ -1941,6 +1946,8 @@ do_send (void *cls)
   GNUNET_assert (ret <= (ssize_t) left);
   if (0 == ret)
   {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "no data send");
     GNUNET_MQ_inject_error (client->mq,
                            GNUNET_MQ_ERROR_WRITE);
     return;
@@ -1958,6 +1965,9 @@ do_send (void *cls)
       if (EPIPE != errno)
         GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
                              "send");
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "socket send returned with error code %i",
+           errno);
       GNUNET_MQ_inject_error (client->mq,
                              GNUNET_MQ_ERROR_WRITE);
       return;
@@ -1968,7 +1978,7 @@ do_send (void *cls)
     GNUNET_MQ_impl_send_in_flight (client->mq);
   }
   client->msg_pos += ret;
-  if (left > ret)
+  if (left > (size_t) ret)
   {
     GNUNET_assert (NULL == client->drop_task);
     client->send_task
@@ -1997,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
+  (void) mq;
   if (NULL != client->drop_task)
     return; /* we're going down right now, do not try to send */
   GNUNET_assert (NULL == client->send_task);
@@ -2026,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq,
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
+  (void) mq;
   GNUNET_assert (0 == client->msg_pos);
   client->msg = NULL;
   GNUNET_SCHEDULER_cancel (client->send_task);
@@ -2402,7 +2414,7 @@ resume_client_receive (void *cls)
                         GNUNET_YES);
   if (GNUNET_SYSERR == ret)
   {
-    if (NULL != c->drop_task)
+    if (NULL == c->drop_task)
       GNUNET_SERVICE_client_drop (c);
     return;
   }
@@ -2514,6 +2526,24 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
 {
   struct GNUNET_SERVICE_Handle *sh = c->sh;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Client dropped: %p (MQ: %p)\n",
+              c,
+              c->mq);
+
+#if EXECINFO
+  void *backtrace_array[MAX_TRACE_DEPTH];
+  int num_backtrace_strings = backtrace (backtrace_array, MAX_TRACE_DEPTH);
+    char **backtrace_strings =
+        backtrace_symbols (backtrace_array,
+         t->num_backtrace_strings);
+    for (unsigned int i = 0; i < num_backtrace_strings; i++)
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+     "client drop trace %u: %s\n",
+     i,
+     backtrace_strings[i]);
+#endif
+
   if (NULL != c->drop_task)
   {
     /* asked to drop twice! */