From af9de78d7de36848f6ff115c9710fb90d2468af2 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 13:58:03 +0000 Subject: swarm: a node says the kind of the document it holds In its handshakes, and checks a peer's against it (AppState::kind): a set of events where one carries its store (Holding::of_a_set), else Automerge's, as it was for every node. --- src/swarm/peer/handshake.rs | 4 ++-- src/swarm/peer/inbound.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/swarm/peer') diff --git a/src/swarm/peer/handshake.rs b/src/swarm/peer/handshake.rs index 2e5a315..fc1bc86 100644 --- a/src/swarm/peer/handshake.rs +++ b/src/swarm/peer/handshake.rs @@ -144,7 +144,7 @@ async fn transmit_hello(state: &AppState, peer: &str) -> Result<()> { .await .map(|root| root.0.to_vec()), party: party(state), - kind: crate::document::KIND.to_owned(), + kind: state.kind().to_owned(), }), ) .await; @@ -255,7 +255,7 @@ pub(super) async fn send_hello_reply( .await .map(|root| root.0.to_vec()), party: party(state), - kind: crate::document::KIND.to_owned(), + kind: state.kind().to_owned(), }; debug!(to = %peer, ready, "Sending HELLO_REPLY"); diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs index a558ded..dbf1a2e 100644 --- a/src/swarm/peer/inbound.rs +++ b/src/swarm/peer/inbound.rs @@ -114,11 +114,11 @@ pub(crate) async fn handle_message( ParsedMessage::HelloReply(reply) => Some(&reply.kind), _ => None, }; - if let Some(theirs) = kind.filter(|kind| *kind != crate::document::KIND) { + if let Some(theirs) = kind.filter(|kind| *kind != state.kind()) { anyhow::bail!( "{peer} holds a document of another kind ({theirs}; this node's is {}): they sync \ nothing; a release that knows the kind does", - crate::document::KIND + state.kind() ); } -- cgit v1.3.1