diff options
Diffstat (limited to 'src/swarm/peer/inbound.rs')
| -rw-r--r-- | src/swarm/peer/inbound.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs index b6c486d..e16eb3f 100644 --- a/src/swarm/peer/inbound.rs +++ b/src/swarm/peer/inbound.rs @@ -124,12 +124,14 @@ pub(crate) async fn handle_message( }; // Of the kinds this node holds, the one the peer holds: what it is told in // turn, and passed on. - state - .get_or_create_peer_state(&peer) - .await - .lock() - .await - .kind = Some(held); + let peer_state = state.get_or_create_peer_state(&peer).await; + let mut peer_state = peer_state.lock().await; + // A handshake of another kind than before: of a node started anew. + #[cfg(feature = "federation")] + if peer_state.kind != Some(held) { + peer_state.set_beside = false; + } + peer_state.kind = Some(held); } // The root its document starts from: another than ours, of our epoch, is another @@ -236,6 +238,7 @@ pub(crate) async fn handle_message( if let transport::SyncBody::Kind(body) = envelope.body && state.holding.has_a_set() { + crate::swarm::set::holds_one_beside(state, &peer).await; crate::swarm::set::received(state, &peer, body).await; } return Ok(()); |
