diff options
| author | tv <tv@krebsco.de> | 2026-11-16 20:44:13 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-16 22:03:31 +0100 |
| commit | c534b25dbd94dc41731f98e4c4b2a170fe02c347 (patch) | |
| tree | 418e159d227599ff985e601dc3ab4f8da8b16af0 /src/swarm/peer | |
| parent | 5cabcbfa81d6293c96d28c603621be331f1f9b0f (diff) | |
handshake: the party its sender is of
In a swarm holding a store, a node's handshakes name the party it is of (`docs/store.md`,
Members), so that a peer tells whether it is a member before its entry reaches it: HELLO
and HELLO_REPLY carry `party`, as `--store-party` says, None elsewhere and without the
`federation` feature. Wire format version 52.
Diffstat (limited to 'src/swarm/peer')
| -rw-r--r-- | src/swarm/peer/handshake.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/swarm/peer/handshake.rs b/src/swarm/peer/handshake.rs index 8e9b0ef..4cc0cf4 100644 --- a/src/swarm/peer/handshake.rs +++ b/src/swarm/peer/handshake.rs @@ -142,6 +142,7 @@ async fn transmit_hello(state: &AppState, peer: &str) -> Result<()> { root: crate::swarm::roots::own(state) .await .map(|root| root.0.to_vec()), + party: party(state), }), ) .await; @@ -242,6 +243,7 @@ pub(super) async fn send_hello_reply( root: crate::swarm::roots::own(state) .await .map(|root| root.0.to_vec()), + party: party(state), }; debug!(to = %peer, ready, "Sending HELLO_REPLY"); @@ -471,3 +473,15 @@ pub(crate) async fn peer_swarm(state: &AppState, peer: &str) -> Option<String> { let peer_state = peer_state_mutex.lock().await; peer_state.standing.swarm_id().map(str::to_owned) } + +/// The party this node is of, as its handshakes name it, in a swarm holding a store +/// (`--store-party`); None elsewhere. +fn party(state: &AppState) -> Option<String> { + #[cfg(feature = "federation")] + return state.holding.party().map(str::to_owned); + #[cfg(not(feature = "federation"))] + { + let _ = state; + None + } +} |
