summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-24 20:09:15 +0200
committertv <tv@krebsco.de>2026-10-24 20:09:15 +0200
commit325c4a2f0fff3a9a7253b7f040c1f71e95739109 (patch)
tree5ae9a8c38885733a4f2d238fe485e211e7343825 /src/state.rs
parent859b3d0a361f883380a381a3a87d6286dbdd2db0 (diff)
follow and download from ready members only
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/state.rs b/src/state.rs
index c51446f..9383c89 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -643,13 +643,14 @@ impl AppState {
self.transport.local_id()
}
- /// Peers that are active and last said they are on our epoch.
+ /// Peers that can serve our epoch's data: active, ready members on our epoch
+ /// (`PeerSummary::serves_epoch`).
pub(crate) async fn active_peers_on_local_epoch(&self) -> Vec<String> {
let epoch = self.local_epoch();
self.peer_summaries()
.await
.into_iter()
- .filter(|peer| peer.active && peer.epoch == Some(epoch))
+ .filter(|peer| peer.serves_epoch(epoch))
.map(|peer| peer.id)
.collect()
}
@@ -1090,6 +1091,9 @@ impl Host for AppState {
summaries.push(PeerSummary {
id,
active: peer.liveness == Liveness::Active,
+ member: matches!(peer.standing, Standing::Member { .. })
+ && peer.hello_state == HelloState::Established,
+ ready: peer.reports_ready,
epoch: peer.epoch,
});
}