only send CHANNEL_DESTROY message if we at least send the CHANNEL_CREATE message...
authorChristian Grothoff <christian@grothoff.org>
Sun, 22 Jan 2017 10:44:22 +0000 (11:44 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sun, 22 Jan 2017 10:44:22 +0000 (11:44 +0100)
src/cadet/gnunet-service-cadet-new_channel.c

index 60e1a77668bac35af450990e1cdae15bf9f8e93d..4bff1a1c5bd118b1e781ac0ee28ec072aa696fea 100644 (file)
@@ -770,9 +770,11 @@ GCCH_channel_local_destroy (struct CadetChannel *ch)
     ch->destroy = GNUNET_YES;
     return;
   }
-  /* Nothing left to do, just finish destruction */
-  GCT_send_channel_destroy (ch->t,
-                            ch->ctn);
+  /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */
+  if (CADET_CHANNEL_NEW != ch->state)
+    GCT_send_channel_destroy (ch->t,
+                              ch->ctn);
+  /* Now finish our clean up */
   channel_destroy (ch);
 }