diff options
| author | tv <tv@krebsco.de> | 2026-10-31 03:49:56 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 03:49:56 +0100 |
| commit | 884893244138d35d9dd3d07ef14b5543c6ee2117 (patch) | |
| tree | a85175778e018057043db6e19f3062d20ab0487e /src/state/peer.rs | |
| parent | 725110193bf2d8acc43a6951decc75d155352a46 (diff) | |
unify sync_on predicate
Diffstat (limited to 'src/state/peer.rs')
| -rw-r--r-- | src/state/peer.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/state/peer.rs b/src/state/peer.rs index dc1b0ec..95a9dc3 100644 --- a/src/state/peer.rs +++ b/src/state/peer.rs @@ -275,6 +275,14 @@ impl PeerState { } } + /// Whether we sync with it on `epoch`: an active member on that epoch (what our + /// STATUS tells it as `syncs_with_you`). + pub(crate) fn syncs_on(&self, epoch: Epoch) -> bool { + !self.liveness.is_dormant() + && matches!(self.standing, Standing::Member { .. }) + && self.epoch == Some(epoch) + } + /// Whether to leave the peer out when choosing neighbours (`swarm::topology`). pub(crate) fn is_unreachable(&self) -> bool { self.unreachable_since.is_some() |
