From b33f4235fe16b8160afb60d0bd743f4c81d9d0ab Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 8 Nov 2026 23:03:42 +0000 Subject: sync: a message carries the signatures of its changes A sync message carried the signatures its peer wasn't sent yet, by a cursor per peer. Changes sent again, as after a message taken as delivered and lost on the way, went without them: the peer was past them. Under a policy requiring signatures they waited until the writer's next signed change, or the next session. A message now carries the signatures of the changes it carries (Signatures::for_changes), whatever the peer was sent before: changes sent again arrive vouched for as the first time. Past 256 (a message carrying the batches of many writers), each writer's latest instead, as a delta carries. The cursor goes, and with it resetting it after a failed send or a new session. --- src/document/sync.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/document/sync.rs') diff --git a/src/document/sync.rs b/src/document/sync.rs index a7a466b..e9afe06 100644 --- a/src/document/sync.rs +++ b/src/document/sync.rs @@ -983,11 +983,11 @@ impl SyncSession { self.state.their_heads.is_none() && we_ready && peer_ready == Some(false) } - /// Whether the message just generated (`generate`) carries changes. - pub(crate) fn carrying(&self) -> bool { + /// The changes the message just generated (`generate`, `push`) carries. + pub(crate) fn carried(&self) -> &[crate::document::ChangeHash] { self.sending .as_ref() - .is_some_and(|sending| !sending.sent.is_empty()) + .map_or(&[], |sending| sending.sent.as_slice()) } /// Which session this is: a message generated from it reports its send's outcome -- cgit v1.3.1