diff options
| author | tv <tv@krebsco.de> | 2026-10-31 06:19:34 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 06:19:34 +0100 |
| commit | 7997793798b8364212fd0f009a68394d61a83e47 (patch) | |
| tree | 13621c9dee8d1faf35a3524992c413f10aad9344 /src/swarm/links.rs | |
| parent | 7a0d6c0d644cb7328cdae24aebc08375c3ba6d94 (diff) | |
dashboard: try to get links dormant immediately
Diffstat (limited to 'src/swarm/links.rs')
| -rw-r--r-- | src/swarm/links.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/swarm/links.rs b/src/swarm/links.rs index fa05e72..7585d3b 100644 --- a/src/swarm/links.rs +++ b/src/swarm/links.rs @@ -1,8 +1,8 @@ //! How members are linked, for a map of the swarm (the dashboard, `api::dashboard`): a //! node asks a member with LINKS, and the member answers with a LINKS_REPLY listing its -//! neighbours, each with the transport its messages go over, whether only through a -//! relay, the round trip and whether the neighbour is dormant: as the member measures -//! them, which no other node can. +//! neighbours and the peers it holds dormant (`own_links`), each with the transport its +//! messages go over, whether only through a relay, the round trip and whether it is +//! dormant: as the member measures them, which no other node can. //! //! Every node answers, whatever its build: one with a dashboard asks any member, which //! may have none. Only members (in the member list) are answered, as the links name @@ -101,14 +101,17 @@ impl Links { } } -/// This node's links: its neighbours, as it measures them. +/// This node's links: its neighbours, and the peers it holds dormant, as it measures +/// them. A neighbour that goes dormant is one no more (it is unreachable now), but its +/// link stays listed, dormant, until it is heard from again: left out, the link would +/// show only as that peer last reported it, from before. pub(crate) async fn own_links(state: &AppState) -> Vec<Link> { let mut links = Vec::new(); for (peer, peer_state) in state.peers_snapshot().await { - if !topology::is_neighbour(state, &peer) { + let dormant = peer_state.lock().await.liveness.is_dormant(); + if !dormant && !topology::is_neighbour(state, &peer) { continue; } - let dormant = peer_state.lock().await.liveness.is_dormant(); let destination = state.transport.destination(&peer); let transport = destination .as_ref() |
