diff options
| author | tv <tv@krebsco.de> | 2026-10-31 03:54:19 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 03:54:19 +0100 |
| commit | 0bb3924836205a0364aaf0959c7cf387db004794 (patch) | |
| tree | 6ed4dd3e25b5138b735dc308a585fc85b5b91640 /src/state | |
| parent | 77e82b5f023a02ec05419a9f18ee600251bbb415 (diff) | |
unify closing logic
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/mod.rs | 11 |
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() } |
