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 | 9db1bb81fa470a41434a92a199a92ab78d7b3b7d (patch) | |
| tree | ddbfb06f2b2d3240f33a6c6df2833fed1a93f8ec /src/api/peers.rs | |
| parent | 58bc4071f2c2cf53b994783ced94d7083a50ea32 (diff) | |
sync with neighbours
Diffstat (limited to 'src/api/peers.rs')
| -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, }); } |
