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
commitc914173379941d7df67ccff0c16a2d6a46c4291d (patch)
tree3eb8a31be05d1e21fd27c675261865d5d931cc68 /src/state.rs
parent377d3b2fa3c2e9f67abe14f2ef9d6f167caa2fa1 (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,
});
}