From 250f99172058f733de3215703173115695297878 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 16:12:30 +0100 Subject: one walk since --- src/document/sync.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/document/sync.rs') diff --git a/src/document/sync.rs b/src/document/sync.rs index bfa0fef..688d455 100644 --- a/src/document/sync.rs +++ b/src/document/sync.rs @@ -564,11 +564,18 @@ impl SyncSession { doc: &Document, before: &[crate::document::ChangeHash], ) -> usize { - let changes = doc.get_changes_meta(before); - for change in &changes { - self.state.sent_hashes.insert(change.hash); - } - changes.len() + let hashes: Vec<_> = doc + .get_changes_meta(before) + .iter() + .map(|c| c.hash) + .collect(); + self.these_came_from_peer(&hashes) + } + + /// `came_from_peer`, for the changes `hashes` (found already). + pub(crate) fn these_came_from_peer(&mut self, hashes: &[crate::document::ChangeHash]) -> usize { + self.state.sent_hashes.extend(hashes.iter().copied()); + hashes.len() } /// Of the changes in `doc` beyond `from`, how many the peer has too, as far as we -- cgit v1.3.1