From 5581992d5603322d7f02bd76625334be3f8a2b18 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Nov 2026 04:44:49 +0100 Subject: measure 2-hop neighbourhood --- src/state/mod.rs | 2 ++ src/state/peer.rs | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'src/state') 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>>>, + /// Whom we reach, as told our neighbours (`swarm::reach`). + pub(crate) reach: Arc>, /// Our neighbours, once known (`swarm::topology`). pub(crate) neighbours: Arc>>, /// 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)>, /// 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 -- cgit v1.3.1