gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37295 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r37295 - gnunet/src/util
Date: Mon, 20 Jun 2016 00:40:01 +0200

Author: grothoff
Date: 2016-06-20 00:40:01 +0200 (Mon, 20 Jun 2016)
New Revision: 37295

Modified:
   gnunet/src/util/client.c
   gnunet/src/util/mq.c
Log:
proper shutdown

Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c    2016-06-19 22:39:40 UTC (rev 37294)
+++ gnunet/src/util/client.c    2016-06-19 22:40:01 UTC (rev 37295)
@@ -505,7 +505,9 @@
     client->tag = NULL;
   }
   client->receiver_handler = NULL;
-  GNUNET_array_grow (client->received_buf, client->received_size, 0);
+  GNUNET_array_grow (client->received_buf,
+                     client->received_size,
+                     0);
   GNUNET_free (client->service_name);
   GNUNET_free (client);
 }

Modified: gnunet/src/util/mq.c
===================================================================
--- gnunet/src/util/mq.c        2016-06-19 22:39:40 UTC (rev 37294)
+++ gnunet/src/util/mq.c        2016-06-19 22:40:01 UTC (rev 37295)
@@ -512,7 +512,8 @@
  * @return number of bytes written to @a buf
  */
 static size_t
-transmit_queued (void *cls, size_t size,
+transmit_queued (void *cls,
+                 size_t size,
                  void *buf)
 {
   struct GNUNET_MQ_Handle *mq = cls;
@@ -521,7 +522,6 @@
   size_t msg_size;
 
   GNUNET_assert (NULL != buf);
-
   msg_size = ntohs (msg->size);
   GNUNET_assert (size >= msg_size);
   memcpy (buf, msg, msg_size);
@@ -632,6 +632,7 @@
   size_t msg_size;
 
   GNUNET_assert (NULL != mq);
+  state->th = NULL;
   msg = GNUNET_MQ_impl_current (mq);
 
   if (NULL == buf)
@@ -667,6 +668,11 @@
 {
   struct ClientConnectionState *state = impl_state;
 
+  if (NULL != state->th)
+  {
+    GNUNET_CLIENT_notify_transmit_ready_cancel (state->th);
+    state->th = NULL;
+  }
   GNUNET_CLIENT_disconnect (state->connection);
   GNUNET_free (impl_state);
 }
@@ -684,8 +690,10 @@
   state->th =
       GNUNET_CLIENT_notify_transmit_ready (state->connection,
                                           ntohs (msg->size),
-                                           GNUNET_TIME_UNIT_FOREVER_REL, 
GNUNET_NO,
-                                           &connection_client_transmit_queued, 
mq);
+                                           GNUNET_TIME_UNIT_FOREVER_REL,
+                                           GNUNET_NO,
+                                           &connection_client_transmit_queued,
+                                           mq);
   GNUNET_assert (NULL != state->th);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]