diff options
| author | tv <tv@krebsco.de> | 2026-11-03 02:43:15 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-03 02:43:15 +0100 |
| commit | 5cd26d321b706113afb8431aba35ab8fb32281c4 (patch) | |
| tree | ae1a64479a29182c44a2375417f74583e4ee074a /src/swarm/relay.rs | |
| parent | e4709cc6ab3fca7f7ce40793aa5cceb64f0bfea3 (diff) | |
announcements answered only if heads differ
Diffstat (limited to 'src/swarm/relay.rs')
| -rw-r--r-- | src/swarm/relay.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/swarm/relay.rs b/src/swarm/relay.rs index 1393d50..a4a4034 100644 --- a/src/swarm/relay.rs +++ b/src/swarm/relay.rs @@ -2,8 +2,9 @@ //! //! 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 STATUS (a keepalive: heads, about 100 -//! bytes, not the changes). A neighbour that sees heads it lacks *pulls*: it enters the +//! its new heads to its other neighbours with a STATUS (heads, about 100 bytes, not the +//! changes; no keepalive, and answered only by a neighbour whose heads differ). 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 //! receives a change about once; the rest is announcements. Regular keepalives work the @@ -11,7 +12,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 STATUS and one STATUS_REPLY per neighbour (plus the pulls), whatever the +//! round costs one STATUS per neighbour (plus the pulls and their replies), 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). @@ -31,7 +32,7 @@ use tracing::debug; use crate::locks::MutexExt; use crate::state::{AppState, Standing}; -use crate::swarm::peer::send_status; +use crate::swarm::peer::announce_heads; use crate::swarm::topology; use crate::transport::{self, HeadsSummary}; @@ -86,7 +87,7 @@ async fn announce_now(state: &AppState, senders: &HashSet<String>) { } state.stats.announce_round(); for peer in neighbours { - if let Err(error) = send_status(state, &peer).await { + if let Err(error) = announce_heads(state, &peer).await { debug!(peer = %peer, error = %format!("{error:#}"), "Announcing our heads failed"); } } |
