aboutsummaryrefslogtreecommitdiffstats
path: root/src/state/peer.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 05:45:57 +0100
committertv <tv@krebsco.de>2026-10-31 05:45:57 +0100
commit29f30daa18df3fd793140927b29837fe25c1c9b9 (patch)
tree8d5f87d375529d887d7098b6788d7731bd28fad0 /src/state/peer.rs
parent612d189f86a6d985db97ea23c5ce1bf72ac077a4 (diff)
centralize call to topology_change
Diffstat (limited to 'src/state/peer.rs')
-rw-r--r--src/state/peer.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/state/peer.rs b/src/state/peer.rs
index 95a9dc3..99f912b 100644
--- a/src/state/peer.rs
+++ b/src/state/peer.rs
@@ -288,6 +288,19 @@ impl PeerState {
self.unreachable_since.is_some()
}
+ /// What choosing neighbours reads of this peer (`swarm::topology::refresh`): whether
+ /// it is unreachable, whether it was ever heard from, whether it is a member, and
+ /// whether it syncs with us. A change to any may change the neighbours
+ /// (`swarm::topology::change_peer`).
+ pub(crate) fn neighbour_inputs(&self) -> impl PartialEq + use<> {
+ (
+ self.is_unreachable(),
+ self.last_seen.is_some(),
+ matches!(self.standing, Standing::Member { .. }),
+ self.syncs_with_us,
+ )
+ }
+
/// The wait before the next HELLO: a probe's if unreachable.
pub(crate) fn next_hello_wait(&mut self) -> Duration {
if self.is_unreachable() {