aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-08 23:03:42 +0000
committertv <tv@krebsco.de>2026-11-09 00:19:31 +0100
commitb33f4235fe16b8160afb60d0bd743f4c81d9d0ab (patch)
treebda3fc914bd72ba67fbe73e50e8799a3191b8870 /src/document/sync.rs
parentb1e6c79bf40d879dd565eeaa5f48f00ae964f4ac (diff)
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.
Diffstat (limited to 'src/document/sync.rs')
-rw-r--r--src/document/sync.rs6
1 files changed, 3 insertions, 3 deletions
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