From 4d09dcfcd7432ab303f848342d2f762b57b7c693 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 03:54:19 +0100 Subject: unify closing logic --- src/state/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/state') 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, pub(crate) initial_sync_done: Arc, - /// The node is shutting down: its keepalives say it isn't ready (`peer::farewell`). - pub(crate) stopping: Arc, + /// 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>, pub(crate) change_events: broadcast::Sender>, @@ -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() } -- cgit v1.3.1