aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
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()
}