aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-03 04:44:49 +0100
committertv <tv@krebsco.de>2026-11-03 04:44:49 +0100
commit5581992d5603322d7f02bd76625334be3f8a2b18 (patch)
tree3c904680730e7fa6071b2712746092c67d91e644 /src/state
parent05dc2d0373cc8d7b0dc4da63a03a7850e4fefdc8 (diff)
measure 2-hop neighbourhood
Diffstat (limited to 'src/state')
-rw-r--r--src/state/mod.rs2
-rw-r--r--src/state/peer.rs5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs
index fef6448..92f7810 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -152,6 +152,8 @@ pub(crate) struct AppState {
/// An announcement round is scheduled, for changes from these peers
/// (`swarm::relay`).
pub(crate) announce_pending: Arc<std::sync::Mutex<Option<std::collections::HashSet<String>>>>,
+ /// Whom we reach, as told our neighbours (`swarm::reach`).
+ pub(crate) reach: Arc<std::sync::Mutex<crate::swarm::reach::Reach>>,
/// Our neighbours, once known (`swarm::topology`).
pub(crate) neighbours: Arc<std::sync::RwLock<Option<crate::swarm::topology::NeighbourView>>>,
/// Something the neighbours are computed from may have changed: the member list or a
diff --git a/src/state/peer.rs b/src/state/peer.rs
index c6558d7..1e09079 100644
--- a/src/state/peer.rs
+++ b/src/state/peer.rs
@@ -151,6 +151,8 @@ pub(crate) struct PeerState {
/// says so). Both lazy (announced only) until a pull makes ours eager.
pub(crate) eager_to: bool,
pub(crate) eager_from: bool,
+ /// Whom it said it reaches (`swarm::reach`), by pair key, and when.
+ pub(crate) reaches: Option<(Instant, Vec<u64>)>,
/// It said farewell (`say_farewell`): what else that run of it still sends while it
/// stops doesn't make it active again; a message from another run does (`returned`).
@@ -244,6 +246,7 @@ impl PeerState {
last_heads: None,
eager_to: false,
eager_from: false,
+ reaches: None,
left: false,
hello_attempts: 0,
unreachable_since: None,
@@ -262,6 +265,8 @@ impl PeerState {
// The link starts lazy again: a pull makes it eager when it proves itself.
self.eager_to = false;
self.eager_from = false;
+ // Said over the session that ended.
+ self.reaches = None;
}
/// An overdue sync answer from an established, active peer (see