diff options
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs index 736f55b..49f75dc 100644 --- a/src/state.rs +++ b/src/state.rs @@ -102,6 +102,10 @@ pub(crate) struct PeerState { /// Consecutive sync exchanges that changed nothing (livelock detection). pub(crate) stalled_exchanges: u32, + /// The peer proved the swarm key in its HELLO or HELLO_REPLY (always false and + /// irrelevant without a swarm key). + pub(crate) authenticated: bool, + /// The answer we expect to our last sync message(s), if any. pub(crate) sync_reply: Option<SyncReplyWait>, /// How long to wait for it; doubles while answers stay out. @@ -141,6 +145,7 @@ impl Default for PeerState { last_sync_rx: None, last_resync_at: None, stalled_exchanges: 0, + authenticated: false, sync_reply: None, sync_reply_timeout: SYNC_REPLY_TIMEOUT, epoch: None, @@ -364,6 +369,10 @@ pub(crate) struct AppState { /// Per-node remake state (prebuilt snapshots, switch status, archive). pub(crate) remake: Arc<RemakeState>, + /// Pre-shared key every member must prove in the handshake; None admits anyone who + /// knows the swarm ID. + pub(crate) swarm_key: Option<Arc<crate::swarm::auth::SwarmKey>>, + /// While rejoining a newer epoch, the previous document, served read-only (and /// marked stale) instead of answering 503. pub(crate) stale: Arc<std::sync::RwLock<Option<StaleView>>>, |
