diff options
Diffstat (limited to 'src/peering/fullmesh.rs')
-rw-r--r-- | src/peering/fullmesh.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs index b579654..793eeb2 100644 --- a/src/peering/fullmesh.rs +++ b/src/peering/fullmesh.rs @@ -8,6 +8,8 @@ use async_trait::async_trait; use log::{debug, info, trace, warn}; use serde::{Deserialize, Serialize}; +use tokio::sync::watch; + use sodiumoxide::crypto::hash; use crate::endpoint::*; @@ -171,8 +173,8 @@ impl FullMeshPeeringStrategy { strat } - pub async fn run(self: Arc<Self>) { - loop { + pub async fn run(self: Arc<Self>, must_exit: watch::Receiver<bool>) { + while !*must_exit.borrow() { // 1. Read current state: get list of connected peers (ping them) let (to_ping, to_retry) = { let known_hosts = self.known_hosts.read().unwrap(); |