aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-05 00:57:05 +0100
committertv <tv@krebsco.de>2026-11-05 00:57:05 +0100
commit0d16147e95211b0829fddaefb0d014fe0c48dbc8 (patch)
treee6b456a23ec9533010189279e4e9655978f481e1 /src/document
parent63871240278181f14af9d561f30b428d5db5e34a (diff)
new changes per message
Diffstat (limited to 'src/document')
-rw-r--r--src/document/sync.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/document/sync.rs b/src/document/sync.rs
index 0aeec83..1f61f70 100644
--- a/src/document/sync.rs
+++ b/src/document/sync.rs
@@ -427,17 +427,19 @@ impl SyncSession {
/// the peer's own changes back. A delta comes outside the sync protocol, so
/// Automerge would think the peer lacks all of it, and offer it back as a delta of
/// our own. Counted as sent (`sent_hashes`), they don't; Automerge forgets them as
- /// sent once the peer's heads cover them. (Changes kept until their predecessors came,
+ /// sent once the peer's heads cover them. Returns how many changes that is. (Changes kept until their predecessors came,
/// from another peer, count too: should this one lack them, it asks, and gets them,
/// `resend_if_needed`.)
pub(crate) fn came_from_peer(
&mut self,
doc: &Document,
before: &[crate::document::ChangeHash],
- ) {
- for change in doc.get_changes_meta(before) {
+ ) -> usize {
+ let changes = doc.get_changes_meta(before);
+ for change in &changes {
self.state.sent_hashes.insert(change.hash);
}
+ changes.len()
}
/// Of the changes in `doc` beyond `from`, how many the peer has too, as far as we