aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/peer
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/peer')
-rw-r--r--src/swarm/peer/handshake.rs14
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
+ }
+}