aboutsummaryrefslogtreecommitdiffstats
path: root/src/state/mod.rs
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
commit4d09dcfcd7432ab303f848342d2f762b57b7c693 (patch)
treed2396328d6ce3ac0e7a251aa582e7215d1e02bf5 /src/state/mod.rs
parentd4e6228a7d81b99ba3607eeb76c31f5b8c2f8d50 (diff)
unify closing logic
Diffstat (limited to 'src/state/mod.rs')
-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()
}