AUTOSTART = @AUTOSTART@
@JAVAPORT@PORT = 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
}
+/**
+ * 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.
*
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)
{
}
+/**
+ * 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.
*
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.
*