aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/peer
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-30 13:58:03 +0000
committertv <tv@krebsco.de>2026-11-30 13:58:03 +0000
commitaf9de78d7de36848f6ff115c9710fb90d2468af2 (patch)
tree57013cd112c7928d72e2a6e2c0c7fb4a55edc92b /src/swarm/peer
parent27b0fb294c47fea75359c3abadab56cd74c93b33 (diff)
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.
Diffstat (limited to 'src/swarm/peer')
-rw-r--r--src/swarm/peer/handshake.rs4
-rw-r--r--src/swarm/peer/inbound.rs4
2 files changed, 4 insertions, 4 deletions
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()
);
}