summaryrefslogtreecommitdiffstats
path: root/src/state/peer.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-28 01:47:47 +0100
committertv <tv@krebsco.de>2026-10-28 01:47:47 +0100
commitdb3c4e997f03a660ac37a6bdf86c6215726a71bd (patch)
tree2aafff562a7cd1c178adbf5b5c5f5e416cb86db6 /src/state/peer.rs
parent34e7ac8d6af652e0d516bce3e204386d54979b7c (diff)
rename PING/PONG to STATUS/STATUS_REPLY
Diffstat (limited to 'src/state/peer.rs')
-rw-r--r--src/state/peer.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/state/peer.rs b/src/state/peer.rs
index 8086f63..c9356ea 100644
--- a/src/state/peer.rs
+++ b/src/state/peer.rs
@@ -67,7 +67,7 @@ const HELLO_RETRY_MAX: Duration = Duration::from_secs(30);
#[derive(Clone)]
pub(crate) struct PeerState {
- /// Whether we lead the pair (`swarm::pair`): we send the keepalive PINGs. Fixed for
+ /// Whether we lead the pair (`swarm::pair`): we send the keepalive STATUSes. Fixed for
/// the pair, so computed once.
pub(crate) leads: bool,
@@ -85,7 +85,7 @@ pub(crate) struct PeerState {
pub(crate) liveness: Liveness,
pub(crate) added_at: Instant,
pub(crate) last_seen: Option<Instant>,
- pub(crate) last_ping_at: Option<Instant>,
+ pub(crate) last_status_at: Option<Instant>,
/// Last time a sync message from this peer was applied (survives resets: the
/// keepalive heal looks at it).
@@ -133,7 +133,7 @@ pub(crate) struct PeerState {
}
/// Trouble with a peer, counted since it was first listed. Lost keepalives and refused
-/// sends are in the traffic counters (`transport::traffic`): every PONG answers a PING.
+/// sends are in the traffic counters (`transport::traffic`): every STATUS_REPLY answers a STATUS.
#[derive(Debug, Default, Clone, Copy, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Incidents {
@@ -172,7 +172,7 @@ impl PeerState {
liveness: Liveness::Active,
added_at: Instant::now(),
last_seen: None,
- last_ping_at: None,
+ last_status_at: None,
last_sync_rx: None,
last_resync_at: None,
diverged_since: None,
@@ -287,15 +287,15 @@ impl PeerState {
true
}
- /// True (and records the ping) if an established, quiet peer needs a keepalive.
+ /// True (and records the time) if an established, quiet peer needs a keepalive.
///
- /// One PING and its PONG tell both sides that the other is alive, so only one side of
- /// a pair needs to ping: the one leading the pair (`leads`). Each of its PINGs
+ /// One STATUS and its STATUS_REPLY tell both sides that the other is alive, so only one side of
+ /// a pair needs to send them: the one leading the pair (`leads`). Each of its STATUSes
/// makes the other side's peer look recently heard from, so the other side never
- /// pings while it does. If the pings stop, the other side pings once it has heard
+ /// sends while it does. If they stop, the other side sends once it has heard
/// nothing for half an interval more. Without that, both sides would get due at about
/// the same time (each one's quiet time starts with the same exchange) and their
- /// PINGs would often cross.
+ /// STATUSes would often cross.
pub(crate) fn take_keepalive_due(&mut self, timing: &Timing, now: Instant) -> bool {
let quiet_enough = if self.leads {
timing.keepalive
@@ -307,16 +307,16 @@ impl PeerState {
&& now.saturating_duration_since(self.added_at) >= timing.keepalive
&& self.quiet_for(now) >= quiet_enough
&& self
- .last_ping_at
+ .last_status_at
.is_none_or(|t| now.saturating_duration_since(t) >= timing.keepalive);
if due {
- self.last_ping_at = Some(now);
+ self.last_status_at = Some(now);
}
due
}
- /// Self-healing check on PING/PONG. Returns true if a re-handshake should start.
+ /// Self-healing check on STATUS/STATUS_REPLY. Returns true if a re-handshake should start.
pub(crate) fn needs_heal(
&mut self,
local: &transport::HeadsSummary,