aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/links.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 06:19:34 +0100
committertv <tv@krebsco.de>2026-10-31 06:19:34 +0100
commit4a587f665b2eddb8cda4dce517ecf8a8e22c6cad (patch)
tree6cec9278a333798038c1dd751d4df5bed9043479 /src/swarm/links.rs
parentc68cc63f6f3e8b025ce114ef26162b62ca67782e (diff)
dashboard: try to get links dormant immediately
Diffstat (limited to 'src/swarm/links.rs')
-rw-r--r--src/swarm/links.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/swarm/links.rs b/src/swarm/links.rs
index 18b2bdd..82cd991 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()