From: Julius Bünger Date: Thu, 28 Jun 2018 22:15:42 +0000 (+0200) Subject: fix cadet api: handle shutdon correctly X-Git-Tag: v0.11.0~322^2~106^2~1^2~4^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=059aa99083b26474f9fa55ad218c611f67db8e1e;p=oweals%2Fgnunet.git fix cadet api: handle shutdon correctly --- diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 85a8be522..319279110 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -1253,18 +1253,21 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) void GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p) { - struct GNUNET_CADET_PortMessage *msg; - struct GNUNET_MQ_Envelope *env; - GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, &p->id, p)); - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE); - msg->port = p->id; - GNUNET_MQ_send (p->cadet->mq, - env); + if (NULL != p->cadet->mq) + { + struct GNUNET_CADET_PortMessage *msg; + struct GNUNET_MQ_Envelope *env; + + env = GNUNET_MQ_msg (msg, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE); + msg->port = p->id; + GNUNET_MQ_send (p->cadet->mq, + env); + } GNUNET_free_non_null (p->handlers); GNUNET_free (p); }