diff options
| author | tv <tv@krebsco.de> | 2026-10-24 04:16:56 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-24 04:16:56 +0200 |
| commit | 5710d1a367a1914d09e0eefe6984408c95a7dd2e (patch) | |
| tree | 435e85ca3ea017c52ad4055c6a810ea685a1acf5 /src/api | |
| parent | b92128a93bc86908290fe3d2a9a424054857535c (diff) | |
sync with neighbours
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/peers.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/peers.rs b/src/api/peers.rs index 6a9a271..d381395 100644 --- a/src/api/peers.rs +++ b/src/api/peers.rs @@ -60,6 +60,8 @@ pub(crate) struct PeerStatus { /// Number of heads in its last keepalive; absent before one, or when it had more /// than 32 (then only their digest is sent). heads: Option<usize>, + /// We keep it alive and sync with it on our own; other peers we only answer. + neighbour: bool, } #[derive(Debug, Serialize, ToSchema)] @@ -106,6 +108,7 @@ pub(crate) async fn list_peers( let mut peers = Vec::with_capacity(snapshot.len()); for (public_key, peer_state_mutex) in snapshot { + let neighbour = crate::swarm::topology::is_neighbour(&state, &public_key); let ps = peer_state_mutex.lock().await; let (status, dormant_for_secs) = match ps.liveness { @@ -129,6 +132,7 @@ pub(crate) async fn list_peers( epoch: ps.epoch.map(EpochInfo::from), same_epoch: ps.epoch.map(|epoch| epoch == local_epoch), heads: ps.reported_heads, + neighbour, }); } |
