diff options
Diffstat (limited to 'src/swarm/peer/inbound.rs')
| -rw-r--r-- | src/swarm/peer/inbound.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs index 35d67c8..b6c486d 100644 --- a/src/swarm/peer/inbound.rs +++ b/src/swarm/peer/inbound.rs @@ -228,11 +228,14 @@ pub(crate) async fn handle_message( .map_err(|error| anyhow!("Failed to notify sync worker: {error}"))?; } transport::ParsedMessage::Sync(envelope) => { - // Of a set of events, where one carries this node's store: its own to - // take (`swarm::set`), and nothing of an Automerge document's. + // Of a set of events: this node's set's to take, where it holds one + // (`swarm::set`); and of an Automerge document nothing, where it holds a set + // alone. #[cfg(feature = "federation")] - if state.of_a_set() { - if let transport::SyncBody::Kind(body) = envelope.body { + if state.of_a_set() || matches!(envelope.body, transport::SyncBody::Kind(_)) { + if let transport::SyncBody::Kind(body) = envelope.body + && state.holding.has_a_set() + { crate::swarm::set::received(state, &peer, body).await; } return Ok(()); |
