diff options
Diffstat (limited to 'src/swarm/peer/inbound.rs')
| -rw-r--r-- | src/swarm/peer/inbound.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs index dbf1a2e..0354356 100644 --- a/src/swarm/peer/inbound.rs +++ b/src/swarm/peer/inbound.rs @@ -218,6 +218,15 @@ 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. + #[cfg(feature = "federation")] + if state.of_a_set() { + if let transport::SyncBody::Kind(body) = envelope.body { + crate::swarm::set::received(state, &peer, body).await; + } + return Ok(()); + } if reactivated { ensure_handshake(state, &peer).await; } @@ -251,6 +260,8 @@ pub(crate) async fn handle_message( crate::swarm::blob::handle(state, &peer, blob).await; } transport::ParsedMessage::Status(remote) => { + #[cfg(feature = "federation")] + let remote = crate::swarm::set::heard_status(state, &peer, remote); // An announcement is no keepalive; it is answered only if we lack some of the // heads it announced (`relay::lacks`), so the announcer learns what we have // that it lacks while we pull. Having all of them, we are as far or further, @@ -290,6 +301,8 @@ pub(crate) async fn handle_message( } } transport::ParsedMessage::StatusReply(remote) => { + #[cfg(feature = "federation")] + let remote = crate::swarm::set::heard_status(state, &peer, remote); // An answer to our slow round's announcement: a tree missed. let announced = peer_state.lock().await.slow_announced_at.take(); if let Some(at) = announced { |
