aboutsummaryrefslogtreecommitdiff
path: root/src/netapp.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-10-14 17:33:12 +0200
committerAlex Auvolat <alex@adnab.me>2021-10-14 17:33:12 +0200
commitcfa64bc745969cfc3684a70b45d71128f8335460 (patch)
tree7b70554e1eb897210a516f2af657e1d0b214ad08 /src/netapp.rs
parent8a0bfa0ff6bc6b79c91c8e635dd00c2f687ec401 (diff)
downloadnetapp-cfa64bc745969cfc3684a70b45d71128f8335460.tar.gz
netapp-cfa64bc745969cfc3684a70b45d71128f8335460.zip
Add netapp function to drop all handlers
Diffstat (limited to 'src/netapp.rs')
-rw-r--r--src/netapp.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/netapp.rs b/src/netapp.rs
index a7a3acf..8c0b50c 100644
--- a/src/netapp.rs
+++ b/src/netapp.rs
@@ -243,6 +243,15 @@ impl NetApp {
.log_err("Failed to await for connection collector");
}
+ /// Drop all endpoint handlers
+ ///
+ /// Use this when terminating to break reference cycles
+ pub fn drop_all_handlers(&self) {
+ for (_, endpoint) in self.endpoints.read().unwrap().iter() {
+ endpoint.drop_handler();
+ }
+ }
+
/// Attempt to connect to a peer, given by its ip:port and its public key.
/// The public key will be checked during the secret handshake process.
/// This function returns once the connection has been established and a