gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33926 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r33926 - gnunet/src/cadet
Date: Fri, 4 Jul 2014 14:29:08 +0200

Author: bartpolot
Date: 2014-07-04 14:29:08 +0200 (Fri, 04 Jul 2014)
New Revision: 33926

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
- fix #3483

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-04 12:29:07 UTC 
(rev 33925)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-04 12:29:08 UTC 
(rev 33926)
@@ -1809,6 +1809,7 @@
     struct GNUNET_MessageHeader *out_msg;
     struct CadetPeer *neighbor;
     struct CadetPeer *endpoint;
+    int pending_msgs;
 
     neighbor = get_hop (c, !fwd);
     endpoint = GCP_get_short (c->path->peers[c->path->length - 1]);
@@ -1816,14 +1817,24 @@
     GCP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
     c->state = CADET_CONNECTION_DESTROYED;
     t = c->t;
+    pending_msgs = c->pending_messages;
     while (NULL != (out_msg = GCP_connection_pop (neighbor, c)))
     {
       GNUNET_assert (NULL ==
                      GCT_send_prebuilt_message (out_msg, t, NULL, GNUNET_YES,
                                                 NULL, NULL));
+      pending_msgs--;
     }
 
-    GCC_destroy (c);
+    /* All pending messages should have been popped and the connection
+     * destroyed. If not, destroy the connection anyway! */
+    if (0 < pending_msgs)
+    {
+      GNUNET_break (0);
+      GCC_destroy (c);
+    }
+    else
+      GNUNET_break (0 == pending_msgs); /* Counter error! */
   }
   else
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]