summaryrefslogtreecommitdiffstats
path: root/src/swarm/topology.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-26 05:45:20 +0100
committertv <tv@krebsco.de>2026-10-26 05:45:20 +0100
commit51e8c8e38c05d98487784e21f9df54cc18875b8b (patch)
tree5b3a6f85ed79549bea8c104d39b9069b40a8d2ef /src/swarm/topology.rs
parentf12a839d6e6bdd29a86ac52d5de836519a41aaf0 (diff)
send bounded peer lists
Diffstat (limited to 'src/swarm/topology.rs')
-rw-r--r--src/swarm/topology.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/swarm/topology.rs b/src/swarm/topology.rs
index 73c2f2c..e396a9d 100644
--- a/src/swarm/topology.rs
+++ b/src/swarm/topology.rs
@@ -39,6 +39,12 @@ pub(crate) struct NeighbourView {
full_mesh: bool,
}
+/// Whether the neighbours are computed from the member list yet (before, everyone
+/// counts as a neighbour).
+pub(crate) fn view_known(state: &AppState) -> bool {
+ state.neighbours.read_or_recover().is_some()
+}
+
/// Whether every reachable member is our neighbour (also while the view is unknown).
pub(crate) fn is_full_mesh(state: &AppState) -> bool {
state
@@ -337,7 +343,7 @@ pub(crate) fn graph(
}
/// Symmetric: the same for (a, b) and (b, a).
-fn pair_score(a: &str, b: &str) -> [u8; 32] {
+pub(crate) fn pair_score(a: &str, b: &str) -> [u8; 32] {
let (low, high) = if a <= b { (a, b) } else { (b, a) };
hash(PAIR_LABEL, &[low, high])
}