handle case of MQM being already NULL
authorChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 13:57:36 +0000 (14:57 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 23 Jan 2017 13:57:36 +0000 (14:57 +0100)
src/cadet/gnunet-service-cadet-new_connection.c
src/cadet/gnunet-service-cadet-new_core.c

index c44511400933547062b3d5b0851e6022ff498a44..b365599bfc79aaf4750435a4f906fc540a5d4af2 100644 (file)
@@ -173,9 +173,12 @@ GCC_destroy (struct CadetConnection *cc)
                          GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);
     destroy_msg->cid = cc->cid;
   }
-  GCP_request_mq_cancel (cc->mq_man,
-                         env);
-  cc->mq_man = NULL;
+  if (NULL != cc->mq_man)
+  {
+    GCP_request_mq_cancel (cc->mq_man,
+                           env);
+    cc->mq_man = NULL;
+  }
   if (NULL != cc->task)
   {
     GNUNET_SCHEDULER_cancel (cc->task);
index 1e35a5102eff487b2f82ba21d6103ebdace494c4..8de780ce0a7bcffd5f517f7178538a751d4e392e 100644 (file)
@@ -312,6 +312,8 @@ send_broken (struct RouteDirection *target,
   struct GNUNET_MQ_Envelope *env;
   struct GNUNET_CADET_ConnectionBrokenMessage *bm;
 
+  if (NULL == target->mqm)
+    return; /* Can't send notification, connection is down! */
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Notifying %s about BROKEN route at %s-%s of connection %s\n",
        GCP_2s (target->hop),
@@ -326,6 +328,7 @@ send_broken (struct RouteDirection *target,
     bm->peer1 = *peer1;
   if (NULL != peer2)
     bm->peer2 = *peer2;
+
   GCP_request_mq_cancel (target->mqm,
                          env);
   target->mqm = NULL;