diff options
Diffstat (limited to 'src/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 0c49fa3..b7bf8ed 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -287,8 +287,18 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> { _ => {} } } - // With what it carries, the signatures the peer wasn't sent yet. - let signatures = if body.is_some() { + // With changes, the signatures the peer wasn't sent yet: they go where + // changes go, along the trees, so a peer that got these changes + // elsewhere got the signatures with them, and a message carrying + // none takes none. + let carries = match &body { + Some( + transport::SyncBody::Changes { .. } | transport::SyncBody::Delta(_), + ) => true, + Some(_) => peer_state.sync.carrying(), + None => false, + }; + let signatures = if carries { let (signatures, sent) = replica.signatures.newer_than(peer_state.signatures_sent); peer_state.signatures_sent = sent; |
