summaryrefslogtreecommitdiffstats
path: root/src/state
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
parent34e7ac8d6af652e0d516bce3e204386d54979b7c (diff)
rename PING/PONG to STATUS/STATUS_REPLY
Diffstat (limited to 'src/state')
-rw-r--r--src/state/host.rs4
-rw-r--r--src/state/mod.rs2
-rw-r--r--src/state/peer.rs24
-rw-r--r--src/state/timing.rs8
4 files changed, 19 insertions, 19 deletions
diff --git a/src/state/host.rs b/src/state/host.rs
index f6c460d..441139e 100644
--- a/src/state/host.rs
+++ b/src/state/host.rs
@@ -29,7 +29,7 @@ impl AppState {
// Tell peers about the new epoch now instead of with the next keepalive (up to a
// keepalive interval later). Ready peers already on it learn it from our sync
- // opening, which goes out right away; everyone else gets a PING, so peers that
+ // opening, which goes out right away; everyone else gets a STATUS, so peers that
// never saw the commit start catching up (we don't sync with them, so nothing
// else would tell them).
let local = self.local_epoch();
@@ -52,7 +52,7 @@ impl AppState {
}
for id in announce {
- if let Err(error) = crate::swarm::peer::send_ping(self, id).await {
+ if let Err(error) = crate::swarm::peer::send_status(self, id).await {
debug!(peer = %id, error = %format!("{error:#}"), "Epoch announcement failed");
}
}
diff --git a/src/state/mod.rs b/src/state/mod.rs
index c8243a2..20f92c5 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -167,7 +167,7 @@ pub(crate) struct CatchUpSource {
pub(crate) reply_timeouts: u32,
/// When we last warned that catching up from it stalls.
pub(crate) last_warned: Option<Instant>,
- /// Our last probe PING to it.
+ /// Our last probe STATUS to it.
pub(crate) last_probe: Option<Instant>,
/// Its keepalives in a row saying it wouldn't sync with us.
pub(crate) refusals: u32,
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,
diff --git a/src/state/timing.rs b/src/state/timing.rs
index 0dab3da..6ce5bef 100644
--- a/src/state/timing.rs
+++ b/src/state/timing.rs
@@ -21,7 +21,7 @@ pub(crate) struct Timing {
pub(crate) dormant_after: Duration,
pub(crate) resync_after: Duration,
pub(crate) dormant_probe: Duration,
- /// While catching up: PING the source after this much silence (`swarm::source`).
+ /// While catching up: send the source a STATUS after this much silence (`swarm::source`).
pub(crate) catch_up_probe: Duration,
/// First wait for an answer to a sync message before sending again; doubles while
/// answers stay out (`SyncSession::reply_backoff`).
@@ -42,8 +42,8 @@ impl Timing {
/// The timings for `--keepalive`.
///
/// Each node keeps about `k` neighbours (`--neighbours`) whatever the swarm's size,
- /// and only one side of a pair pings, so idle, a node sends about `k` messages and
- /// receives about `k` (PINGs and PONGs) per keepalive interval (more on a stable
+ /// and only one side of a pair sends them, so idle, a node sends about `k` messages and
+ /// receives about `k` (STATUSes and STATUS_REPLYs) per keepalive interval (more on a stable
/// member others prefer). The interval trades that against how soon a silent peer is
/// noticed (`dormant_after`, 4 intervals) and a gap closes (within an interval).
/// Recommended:
@@ -68,7 +68,7 @@ impl Timing {
) -> Self {
Self {
keepalive,
- dormant_after: keepalive * 4, // dormant_after >= 4* keepalive to tolerate three lost PINGs in a row
+ dormant_after: keepalive * 4, // dormant_after >= 4* keepalive to tolerate three lost STATUSes in a row
// >= 2 keepalives, so a second exchange confirms the difference; and >= twice
// the first sync reply timeout, so a lost message's sender resends it first.
resync_after: (keepalive * 2).max(sync_reply_timeout * 2),