aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/document/sync.rs6
-rw-r--r--src/swarm/peer/inbound.rs3
-rw-r--r--src/swarm/peer/keepalive.rs2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/document/sync.rs b/src/document/sync.rs
index 5669ce3..41d818d 100644
--- a/src/document/sync.rs
+++ b/src/document/sync.rs
@@ -825,9 +825,9 @@ impl SyncSession {
true
}
- /// The peer said its `heads` outside the sync (a keepalive STATUS): it has every
- /// change in their history. Automerge forgets changes as sent only when the peer's
- /// sync message says it has them, and a neighbour another parent brings the changes
+ /// The peer said its `heads` outside the sync (a keepalive STATUS or a STATUS_REPLY):
+ /// it has every change in their history. Automerge forgets changes as sent only when
+ /// the peer's sync message says it has them, and a neighbour another parent brings the changes
/// to (`known_to_peer`) sends us none while it has nothing to write: counted as sent,
/// every change would stay so. So those in the history of `heads` count as sent no
/// more, and the peer as having all up to `heads`: the next message to it carries
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs
index 8a424b8..8980fd3 100644
--- a/src/swarm/peer/inbound.rs
+++ b/src/swarm/peer/inbound.rs
@@ -235,6 +235,9 @@ pub(crate) async fn handle_message(
if let Some(at) = announced {
crate::swarm::relay::slow_round_answered(state, at.elapsed());
}
+ // Keepalives go one way between a pair (the one with the shorter interval
+ // takes the turns): the other side hears the peer's heads in its replies.
+ heard_heads(state, &peer, &remote);
on_status(state, &peer, &remote, reactivated).await;
}
transport::ParsedMessage::Links(request) => {
diff --git a/src/swarm/peer/keepalive.rs b/src/swarm/peer/keepalive.rs
index 693a370..a4def86 100644
--- a/src/swarm/peer/keepalive.rs
+++ b/src/swarm/peer/keepalive.rs
@@ -218,7 +218,7 @@ pub(super) async fn status_received(state: &AppState, peer: &str) {
}
}
-/// A keepalive STATUS said the peer's heads: what it has counts as sent to it no more
+/// A keepalive STATUS, or a STATUS_REPLY, said the peer's heads: what it has counts as sent to it no more
/// (`SyncSession::heard_heads`). Off the consumer: it takes the document's lock.
pub(super) fn heard_heads(state: &AppState, peer: &str, remote: &transport::Status) {
let Some(heads) = remote.heads.heads() else {