diff options
Diffstat (limited to 'src/swarm/topology.rs')
| -rw-r--r-- | src/swarm/topology.rs | 8 |
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]) } |
