Fix shutdown assertion failure in core_api: avoid double cancel of pending traffic
authorBart Polot <bart@net.in.tum.de>
Tue, 3 May 2016 18:38:43 +0000 (18:38 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 3 May 2016 18:38:43 +0000 (18:38 +0000)
src/cadet/gnunet-service-cadet_peer.c

index 46961250b0ad6a43575cc10f19d54fbbaccec4b9..ee8f9652f5e899b847a026ee541bf919020b6acb 100644 (file)
@@ -775,8 +775,6 @@ peer_destroy (struct CadetPeer *peer)
     GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (peer->connections));
     GNUNET_CONTAINER_multihashmap_destroy (peer->connections);
   }
-  if (NULL != peer->core_transmit)
-    GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit);
   if (NULL != peer->hello_offer)
   {
     GNUNET_TRANSPORT_offer_hello_cancel (peer->hello_offer);
@@ -791,6 +789,13 @@ peer_destroy (struct CadetPeer *peer)
   {
     GCP_queue_destroy (peer->queue_head, GNUNET_YES, GNUNET_NO, 0);
   }
+  if (NULL != peer->core_transmit)
+  {
+    GNUNET_break (0); /* GCP_queue_destroy should've cancelled it! */
+    GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit);
+    peer->core_transmit = NULL;
+  }
+
   GNUNET_free_non_null (peer->hello);
   GNUNET_free (peer);
   return GNUNET_OK;