aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/topology/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/topology/mod.rs')
-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 179cf83..b001809 100644
--- a/src/swarm/topology/mod.rs
+++ b/src/swarm/topology/mod.rs
@@ -100,6 +100,16 @@ pub(crate) fn member_list_graph(
})))
}
+/// Whether `peer` is in the member list, as the view was last computed from it; None
+/// while the view isn't known.
+pub(crate) fn listed(state: &AppState, peer: &str) -> Option<bool> {
+ state
+ .neighbours
+ .read_or_recover()
+ .as_ref()
+ .map(|view| view.members.iter().any(|member| member == peer))
+}
+
/// Whether the neighbours are computed from the member list yet (before, everyone
/// counts as a neighbour).
pub(crate) fn view_known(state: &AppState) -> bool {