From: Christian Grothoff Date: Sat, 13 Jan 2018 13:47:16 +0000 (+0100) Subject: use assert to guard better against double-close on client side X-Git-Tag: v0.11.0pre66~249^2~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=801c75f9134547f7fb9b19a881ce96e4c37450ea;p=oweals%2Fgnunet.git use assert to guard better against double-close on client side --- diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 6b07ab7b7..3c142a95c 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -1276,15 +1276,15 @@ 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); - GNUNET_assert (GNUNET_YES == - GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, - &p->id, - p)); GNUNET_free_non_null (p->handlers); GNUNET_free (p); } @@ -1673,7 +1673,7 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Listening to CADET port %s\n", GNUNET_h2s (port)); - + p = GNUNET_new (struct GNUNET_CADET_Port); p->cadet = h; p->id = *port;