diff options
Diffstat (limited to 'src/swarm')
| -rw-r--r-- | src/swarm/topology/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/swarm/topology/mod.rs b/src/swarm/topology/mod.rs index b876fd0..afa13ee 100644 --- a/src/swarm/topology/mod.rs +++ b/src/swarm/topology/mod.rs @@ -57,7 +57,10 @@ pub(crate) struct NeighbourView { /// they say they sync with us (`refresh`). outbound: BTreeSet<String>, neighbours: BTreeSet<String>, - /// Every reachable member is a neighbour. + /// Every member not judged unreachable is a neighbour (the tests wait for it, + /// `is_full_mesh`). Not the swarm being a full mesh: members on a transport we are + /// not on, or that we never reached, don't count against it. + #[cfg(test)] full_mesh: bool, /// The graph the member list gives, as if every member reached every other /// (`member_list_graph`): computed when first asked for, kept while the member list @@ -123,7 +126,6 @@ pub(crate) struct Summary { pub(crate) stable: usize, pub(crate) neighbours: usize, pub(crate) stable_neighbours: usize, - pub(crate) full_mesh: bool, } pub(crate) fn summary(state: &AppState) -> Option<Summary> { @@ -146,7 +148,6 @@ pub(crate) fn summary(state: &AppState) -> Option<Summary> { .iter() .filter(|m| view.stable.contains(*m)) .count(), - full_mesh: view.full_mesh, }) } @@ -412,6 +413,7 @@ pub(crate) async fn refresh(state: &AppState) -> Option<NeighbourChange> { &|m| stable.contains(m), ); computed.extend(outbound.iter().cloned()); + #[cfg(test)] let listed_neighbours = computed.len(); computed.extend(unlisted.iter().cloned()); let change = NeighbourChange { @@ -438,11 +440,13 @@ pub(crate) async fn refresh(state: &AppState) -> Option<NeighbourChange> { removed = change.removed.len(), "Neighbours computed from the member list" ); + #[cfg(test)] let reachable_others = current .iter() .filter(|m| m.as_str() != state.local_id() && !unreachable.contains(*m)) .count(); *state.neighbours.write_or_recover() = Some(NeighbourView { + #[cfg(test)] full_mesh: listed_neighbours >= reachable_others, members: current, k, |
