From: Christian Grothoff Date: Sun, 29 Jan 2017 19:20:48 +0000 (+0100) Subject: fix shutdown sequence X-Git-Tag: taler-0.2.1~250 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=087042f41a8264c418bb453cfeda4ca48d54276e;p=oweals%2Fgnunet.git fix shutdown sequence --- 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@ @JAVAPORT@PORT = 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;ioff;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;ientries_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); } }