gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33931 - gnunet/src/cadet
Date: Sat, 5 Jul 2014 02:13:06 +0200

Author: bartpolot
Date: 2014-07-05 02:13:06 +0200 (Sat, 05 Jul 2014)
New Revision: 33931

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
- document code, small sanity checks

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-04 21:38:45 UTC 
(rev 33930)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-05 00:13:06 UTC 
(rev 33931)
@@ -1803,6 +1803,7 @@
     return GNUNET_OK;
   }
 
+  t = c->t;
   fwd = is_fwd (c, id);
   if (GCC_is_terminal (c, fwd))
   {
@@ -1811,13 +1812,21 @@
     struct CadetPeer *endpoint;
     int pending_msgs;
 
+    if (NULL == t)
+    {
+      /* A terminal connection should not have 't' set to NULL. */
+      GNUNET_break (0);
+      return GNUNET_OK;
+    }
     neighbor = get_hop (c, !fwd);
     endpoint = GCP_get_short (c->path->peers[c->path->length - 1]);
     path_invalidate (c->path);
     GCP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
     c->state = CADET_CONNECTION_DESTROYED;
-    t = c->t;
     pending_msgs = c->pending_messages;
+
+    /* GCP_connection_pop will destroy the connection when the last message
+     * is popped! Do not use 'c' after the call. */
     while (NULL != (out_msg = GCP_connection_pop (neighbor, c)))
     {
       GNUNET_assert (NULL ==




reply via email to

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