do not die if client closes port it never opened
authorChristian Grothoff <christian@grothoff.org>
Sat, 13 Jan 2018 13:46:26 +0000 (14:46 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 13 Jan 2018 13:46:26 +0000 (14:46 +0100)
src/cadet/gnunet-service-cadet.c

index c3e99e0ebeae687f2f8982b3b98ddc6a181a78a4..20e4c363ef17d7b04dfe35a4249644286b089df4 100644 (file)
@@ -75,7 +75,7 @@ struct CadetClient
    * Handle to communicate with the client
    */
   struct GNUNET_MQ_Handle *mq;
-  
+
   /**
    * Client handle.
    */
@@ -536,6 +536,13 @@ handle_port_close (void *cls,
        "Closing port %s as requested by %s\n",
        GNUNET_h2s (&pmsg->port),
        GSC_2s (c));
+  if (NULL == c->ports)
+  {
+    /* Client closed a port despite _never_ having opened one? */
+    GNUNET_break (0);
+    GNUNET_SERVICE_client_drop (c->client);
+    return;
+  }
   op = GNUNET_CONTAINER_multihashmap_get (c->ports,
                                          &pmsg->port);
   if (NULL == op)