diff options
| author | tv <tv@krebsco.de> | 2026-11-05 16:10:14 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-05 16:10:14 +0100 |
| commit | 065bf2f9e738eae219da1fe0557ec22f94f10b7a (patch) | |
| tree | 4c4b8191cc7902898a776c429b6b9d09a798d26c /src/swarm/sync.rs | |
| parent | 12fae75f850c3ca63a68378b2684b5d89f667e10 (diff) | |
waiting not twice
Diffstat (limited to 'src/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 0edc277..5511ea2 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -574,6 +574,7 @@ pub(crate) async fn handle_sync( peer_state.last_heads = Some((epoch, transport::HeadsSummary::of(message.heads().to_vec()))); let heads_before = replica.heads().to_vec(); + let said = message.heads().to_vec(); let sync = &mut peer_state.sync; replica @@ -617,7 +618,13 @@ pub(crate) async fn handle_sync( stats.new_changes(new); } if carried && !changed { - stats.nothing_new(payload_len, writer.is_some(), delivered, sizes); + // Its heads not ours yet: what it brought waits for predecessors, which + // isn't having come twice. + if !crate::document::changes::holds_all(&replica.doc, &said) { + stats.waiting(); + } else { + stats.nothing_new(payload_len, writer.is_some(), delivered, sizes); + } } // Whose they are, to pass them on along their writers' trees, however they // came (along a tree, with an answer, pulled). |
