gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 01/02: fix shutdown sequence


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 01/02: fix shutdown sequence
Date: Sun, 29 Jan 2017 20:33:45 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit 087042f41a8264c418bb453cfeda4ca48d54276e
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 29 20:20:48 2017 +0100

    fix shutdown sequence
---
 src/cadet/cadet.conf.in                         |  2 +-
 src/cadet/gnunet-service-cadet-new_connection.c |  4 ++++
 src/cadet/gnunet-service-cadet-new_paths.c      | 16 +++++++++++++++-
 src/cadet/gnunet-service-cadet-new_tunnels.c    | 13 ++++++++-----
 4 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/cadet/cadet.conf.in b/src/cadet/cadet.conf.in
index 86ba2e535..296a648e2 100644
--- a/src/cadet/cadet.conf.in
+++ b/src/cadet/cadet.conf.in
@@ -4,7 +4,7 @@ AUTOSTART = @AUTOSTART@
 @address@hidden = 2096
 HOSTNAME = localhost
 BINARY = gnunet-service-cadet-new
-# PREFIX = valgrind --leak-check=yes
+PREFIX = valgrind --leak-check=yes
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-cadet.sock
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c 
b/src/cadet/gnunet-service-cadet-new_connection.c
index f3603a694..688cb1f80 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.c
+++ b/src/cadet/gnunet-service-cadet-new_connection.c
@@ -225,6 +225,10 @@ GCC_destroy (struct CadetConnection *cc)
   GCPP_del_connection (cc->path,
                        cc->off,
                        cc);
+  for (unsigned int i=0;i<cc->off;i++)
+    GCP_remove_connection (GCPP_get_peer_at_offset (cc->path,
+                                                    i),
+                           cc);
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multishortmap_remove (connections,
                                                         &GCC_get_id 
(cc)->connection_of_tunnel,
diff --git a/src/cadet/gnunet-service-cadet-new_paths.c 
b/src/cadet/gnunet-service-cadet-new_paths.c
index 28df5e159..05d702717 100644
--- a/src/cadet/gnunet-service-cadet-new_paths.c
+++ b/src/cadet/gnunet-service-cadet-new_paths.c
@@ -28,6 +28,7 @@
  */
 #include "platform.h"
 #include "gnunet-service-cadet-new_connection.h"
+#include "gnunet-service-cadet-new_tunnels.h"
 #include "gnunet-service-cadet-new_peer.h"
 #include "gnunet-service-cadet-new_paths.h"
 
@@ -191,7 +192,20 @@ path_destroy (struct CadetPeerPath *path)
        "Destroying path %s\n",
        GCPP_2s (path));
   for (unsigned int i=0;i<path->entries_length;i++)
-    GNUNET_free (path->entries[i]);
+  {
+    struct CadetPeerPathEntry *entry = path->entries[i];
+
+    if (NULL != entry->cc)
+    {
+      struct CadetTConnection *ct;
+
+      ct = GCC_get_ct (entry->cc);
+      if (NULL != ct)
+        GCT_connection_lost (ct);
+      GCC_destroy_without_tunnel (entry->cc);
+    }
+    GNUNET_free (entry);
+  }
   GNUNET_free (path->entries);
   GNUNET_free (path);
 }
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c 
b/src/cadet/gnunet-service-cadet-new_tunnels.c
index e41164220..1afd75bb2 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -2037,6 +2037,7 @@ destroy_tunnel (void *cls)
     GNUNET_free (t->unverified_ax);
   }
   cleanup_ax (&t->ax);
+  GNUNET_assert (NULL == t->destroy_task);
   GNUNET_free (t);
 }
 
@@ -2061,12 +2062,14 @@ GCT_remove_channel (struct CadetTunnel *t,
                  GNUNET_CONTAINER_multihashmap32_remove (t->channels,
                                                          ntohl (ctn.cn),
                                                          ch));
-  if (0 ==
-      GCT_count_channels (t))
+  if ( (0 ==
+        GCT_count_channels (t)) &&
+       (NULL == t->destroy_task) )
   {
-    t->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_DESTROY_DELAY,
-                                                    &destroy_tunnel,
-                                                    t);
+    t->destroy_task
+      = GNUNET_SCHEDULER_add_delayed (IDLE_DESTROY_DELAY,
+                                      &destroy_tunnel,
+                                      t);
   }
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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