aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-31 03:54:19 +0100
committertv <tv@krebsco.de>2026-10-31 03:54:19 +0100
commit089ba263cf84483b33070d786e1023520b2c9129 (patch)
tree3bab9d7f9e8bd087ce553bd857e5ed8b3ad1c692 /src/state
parent4514af827e4ecad4c7bd15adde5f0b4ae66529a4 (diff)
unify closing logic
Diffstat (limited to 'src/state')
-rw-r--r--src/state/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs
index d7c80c2..2f3d433 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -84,8 +84,10 @@ pub(crate) struct AppState {
pub(crate) change_tx: watch::Sender<u64>,
pub(crate) initial_sync_done: Arc<AtomicBool>,
- /// The node is shutting down: its keepalives say it isn't ready (`peer::farewell`).
- pub(crate) stopping: Arc<AtomicBool>,
+ /// True once the node shuts down (a signal, a failed join, a transport gone): the
+ /// HTTP API drains and its long-lived responses end, and keepalives say the node
+ /// isn't ready and is leaving (`peer::farewell`).
+ pub(crate) closing: Arc<watch::Sender<bool>>,
pub(crate) change_events: broadcast::Sender<Arc<ChangeSet>>,
@@ -177,6 +179,11 @@ pub(crate) struct CatchUpSource {
}
impl AppState {
+ /// Whether the node shuts down (`closing`).
+ pub(crate) fn is_closing(&self) -> bool {
+ *self.closing.borrow()
+ }
+
pub(crate) fn local_id(&self) -> &str {
self.transport.local_id()
}