From c64c2d283ae99581bf5f06fed0303f7f2d82f980 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 17:50:58 +0100 Subject: unreachability doesn't expire --- src/swarm/peer/handshake.rs | 5 +---- src/swarm/topology.rs | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src/swarm') diff --git a/src/swarm/peer/handshake.rs b/src/swarm/peer/handshake.rs index f89e371..f08929a 100644 --- a/src/swarm/peer/handshake.rs +++ b/src/swarm/peer/handshake.rs @@ -150,10 +150,7 @@ async fn transmit_hello(state: &AppState, peer: &str) -> Result<()> { if !was_unreachable && peer_state.unreachable_since.is_some() { state.topology_changed.notify_one(); } - let wait = match peer_state.liveness { - Liveness::Dormant { .. } => state.timing.dormant_probe, - Liveness::Active => peer_state.hello_backoff.next(), - }; + let wait = peer_state.next_hello_wait(); peer_state.hello_state = HelloState::AwaitingReply { next_attempt: Instant::now() + wait, }; diff --git a/src/swarm/topology.rs b/src/swarm/topology.rs index e396a9d..84ae1cd 100644 --- a/src/swarm/topology.rs +++ b/src/swarm/topology.rs @@ -20,7 +20,6 @@ use std::collections::{BTreeMap, BTreeSet}; use sha2::{Digest, Sha256}; -use tokio::time::Instant; use tracing::info; use crate::locks::RwLockExt; @@ -111,8 +110,7 @@ pub(crate) struct NeighbourChange { /// Recomputes the neighbours whenever something they depend on may have changed /// (`AppState::topology_changed`): the member list (`swarm::sync::run_change_publisher`), /// a peer becoming unreachable or reachable again (`swarm::peer`), and every 5 s as a -/// fallback, which also covers unreachability expiring after `dormant_probe`. A burst of -/// notifications coalesces into one recomputation. +/// fallback. A burst of notifications coalesces into one recomputation. pub(crate) async fn run_worker(state: AppState) { loop { state.topology_changed.notified().await; @@ -145,11 +143,10 @@ pub(crate) async fn refresh(state: &AppState) -> Option { (current, stable) }; let k = state.neighbours_k; - let now = Instant::now(); let mut unreachable = BTreeSet::new(); for member in ¤t { if let Some(peer_state) = state.get_peer_state(member).await { - if peer_state.lock().await.is_unreachable(&state.timing, now) { + if peer_state.lock().await.is_unreachable() { unreachable.insert(member.clone()); } } -- cgit v1.3.1