fix shutdown sequence on MQ errors
authorChristian Grothoff <christian@grothoff.org>
Wed, 22 Feb 2017 22:51:45 +0000 (23:51 +0100)
committerChristian Grothoff <christian@grothoff.org>
Wed, 22 Feb 2017 22:51:45 +0000 (23:51 +0100)
src/util/service_new.c

index 731be2cfed35c6d0a7834420836f588832e78b2e..eaaf053b8c80fb496c01a3297443ea467bc7991d 100644 (file)
@@ -1996,8 +1996,9 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
+  if (NULL != client->drop_task)
+    return; /* we're going down right now, do not try to send */
   GNUNET_assert (NULL == client->send_task);
-  GNUNET_assert (NULL == client->drop_task);
   client->msg = msg;
   client->msg_pos = 0;
   client->send_task
@@ -2466,6 +2467,10 @@ finish_client_drop (void *cls)
   struct GNUNET_SERVICE_Client *c = cls;
   struct GNUNET_SERVICE_Handle *sh = c->sh;
 
+  c->drop_task = NULL;
+  GNUNET_assert (NULL == c->send_task);
+  GNUNET_assert (NULL == c->recv_task);
+  GNUNET_assert (NULL == c->warn_task);
   GNUNET_MST_destroy (c->mst);
   GNUNET_MQ_destroy (c->mq);
   if (GNUNET_NO == c->persist)