From db3c4e997f03a660ac37a6bdf86c6215726a71bd Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 28 Oct 2026 01:47:47 +0100 Subject: rename PING/PONG to STATUS/STATUS_REPLY --- src/swarm/relay.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/swarm/relay.rs') diff --git a/src/swarm/relay.rs b/src/swarm/relay.rs index 202ae40..6172f67 100644 --- a/src/swarm/relay.rs +++ b/src/swarm/relay.rs @@ -2,7 +2,7 @@ //! //! A node pushes its own changes to its neighbours, but nothing it receives goes any //! further by itself. So after applying changes from one neighbour, a node *announces* -//! its new heads to its other neighbours with a PING (a keepalive: heads, about 100 +//! its new heads to its other neighbours with a STATUS (a keepalive: heads, about 100 //! bytes, not the changes). A neighbour that sees heads it lacks *pulls*: it enters the //! announced heads as the peer's heads in its sync state, Automerge asks for what's //! missing (`need`), and the announcer answers with exactly those changes. Each node @@ -11,7 +11,7 @@ //! //! Announcements are coalesced: the first applied change schedules one announcement //! round `ANNOUNCE_DELAY` later, and every change applied until then rides along. A -//! round costs one PING and one PONG per neighbour (plus the pulls), whatever the +//! round costs one STATUS and one STATUS_REPLY per neighbour (plus the pulls), whatever the //! write rate; the delay is the price per hop. Without coalescing, every applied sync //! message would announce to every neighbour, and announcements would outnumber the //! data they announce (about 15 to 1 at 250 nodes). @@ -27,7 +27,7 @@ use tracing::debug; use crate::locks::MutexExt; use crate::state::{AppState, Standing}; -use crate::swarm::peer::send_ping; +use crate::swarm::peer::send_status; use crate::swarm::sync::SyncEvent; use crate::swarm::topology; use crate::transport::{self, HeadsSummary}; @@ -97,7 +97,7 @@ async fn announce_now(state: &AppState, senders: &HashSet) { .cloned() .collect(); for peer in neighbours { - if let Err(error) = send_ping(state, &peer).await { + if let Err(error) = send_status(state, &peer).await { debug!(peer = %peer, error = %format!("{error:#}"), "Announcing our heads failed"); } } @@ -111,7 +111,7 @@ pub(crate) struct Pulling { /// The neighbour we are pulling from, and since when. current: Option<(String, Instant)>, /// The latest keepalive of each neighbour waiting to be pulled from. - waiting: HashMap, + waiting: HashMap, } /// A keepalive from `peer`: if it has heads we lack, pull them (one peer at a time; a @@ -119,7 +119,7 @@ pub(crate) struct Pulling { pub(crate) async fn pull_if_behind( state: &AppState, peer: &str, - remote: &transport::Keepalive, + remote: &transport::Status, ) -> bool { if remote.epoch != state.local_epoch() || !topology::is_neighbour(state, peer) { return false; -- cgit v1.3.1