aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/topology
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/topology')
-rw-r--r--src/swarm/topology/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs
index 992c448..e5dacdd 100644
--- a/src/swarm/topology/mod.rs
+++ b/src/swarm/topology/mod.rs
@@ -113,6 +113,16 @@ pub(crate) fn summary(state: &AppState) -> Option<Summary> {
})
}
+/// Whether `peer` is in the member list the neighbours were computed from (false until
+/// the view is known).
+pub(crate) fn is_listed(state: &AppState, peer: &str) -> bool {
+ state
+ .neighbours
+ .read_or_recover()
+ .as_ref()
+ .is_some_and(|view| view.members.iter().any(|member| member == peer))
+}
+
/// Whether we initiate contact with `peer`: HELLOs, keepalives, dormancy checks, sync
/// openings. Everyone is a neighbour until the view is known (while joining, or before
/// any member registered), so joining works as in a full mesh. We always *answer*