[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: ensure tunnels are shutdown
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: ensure tunnels are shutdown at the right time during shutdown |
Date: |
Sun, 22 Jan 2017 00:10:28 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new e6b80ab7b ensure tunnels are shutdown at the right time during shutdown
e6b80ab7b is described below
commit e6b80ab7b7de86928aafb7ccfd39a2019f256fd6
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 22 00:10:26 2017 +0100
ensure tunnels are shutdown at the right time during shutdown
---
src/cadet/cadet.conf.in | 2 +-
src/cadet/gnunet-service-cadet-new.c | 29 +++++++++++++++++++++++++++-
src/cadet/gnunet-service-cadet-new_tunnels.c | 15 ++++++++++++++
src/cadet/gnunet-service-cadet-new_tunnels.h | 9 +++++++++
4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/cadet/cadet.conf.in b/src/cadet/cadet.conf.in
index 1ee830dbf..88f49fde8 100644
--- a/src/cadet/cadet.conf.in
+++ b/src/cadet/cadet.conf.in
@@ -3,7 +3,7 @@ FORCESTART = YES
AUTOSTART = @AUTOSTART@
@address@hidden = 2096
HOSTNAME = localhost
-BINARY = gnunet-service-cadet-new
+BINARY = gnunet-service-cadet
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.c
b/src/cadet/gnunet-service-cadet-new.c
index 6ba0df69e..ff143b4b3 100644
--- a/src/cadet/gnunet-service-cadet-new.c
+++ b/src/cadet/gnunet-service-cadet-new.c
@@ -311,6 +311,30 @@ GSC_bind (struct CadetClient *c,
/**
+ * Callback invoked on all peers to destroy all tunnels
+ * that may still exist.
+ *
+ * @param cls NULL
+ * @param pid identify of a peer
+ * @param value a `struct CadetPeer` that may still have a tunnel
+ * @return #GNUNET_OK (iterate over all entries)
+ */
+static int
+destroy_tunnels_now (void *cls,
+ const struct GNUNET_PeerIdentity *pid,
+ void *value)
+{
+ struct CadetPeer *cp = value;
+ struct CadetTunnel *t = GCP_get_tunnel (cp,
+ GNUNET_NO);
+
+ if (NULL != t)
+ GCT_destroy_tunnel_now (t);
+ return GNUNET_OK;
+}
+
+
+/**
* Task run during shutdown.
*
* @param cls unused
@@ -338,7 +362,10 @@ shutdown_task (void *cls)
GNUNET_CONTAINER_multihashmap_destroy (loose_channels);
loose_channels = NULL;
}
- /* All channels, connections and CORE must be down before this point. */
+ /* Destroy tunnels. Note that all channels must be destroyed first! */
+ GCP_iterate_all (&destroy_tunnels_now,
+ NULL);
+ /* All tunnels, channels, connections and CORE must be down before this
point. */
GCP_destroy_all_peers ();
if (NULL != peers)
{
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c
b/src/cadet/gnunet-service-cadet-new_tunnels.c
index 73bbaf042..06c98fcee 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -1559,6 +1559,21 @@ GCT_remove_channel (struct CadetTunnel *t,
/**
+ * Destroys the tunnel @a t now, without delay. Used during shutdown.
+ *
+ * @param t tunnel to destroy
+ */
+void
+GCT_destroy_tunnel_now (struct CadetTunnel *t)
+{
+ GNUNET_assert (0 ==
+ GNUNET_CONTAINER_multihashmap32_size (t->channels));
+ GNUNET_SCHEDULER_cancel (t->destroy_task);
+ destroy_tunnel (t);
+}
+
+
+/**
* It's been a while, we should try to redo the KX, if we can.
*
* @param cls the `struct CadetTunnel` to do KX for.
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.h
b/src/cadet/gnunet-service-cadet-new_tunnels.h
index 3c88ae5f0..c867a9e82 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.h
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.h
@@ -99,6 +99,15 @@ GCT_create_tunnel (struct CadetPeer *destination);
/**
+ * Destroys the tunnel @a t now, without delay. Used during shutdown.
+ *
+ * @param t tunnel to destroy
+ */
+void
+GCT_destroy_tunnel_now (struct CadetTunnel *t);
+
+
+/**
* Add a @a connection to the @a tunnel.
*
* @param t a tunnel
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: ensure tunnels are shutdown at the right time during shutdown,
gnunet <=