restore signal state after channel failures

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-06 13:53:21 +00:00
parent c1c084dda1
commit a309ef55c9

View file

@ -76,7 +76,10 @@ impl Server {
return Err(Error::Err("Shutdown already in progress".into()));
}
self.signal("SIGINT")
self.signal("SIGINT").inspect_err(|_| {
self.stopping.store(false, Ordering::Release);
self.reloading.store(false, Ordering::Release);
})
}
pub fn restart(&self) -> Result<()> {
@ -85,6 +88,7 @@ impl Server {
}
self.shutdown()
.inspect_err(|_| self.restarting.store(false, Ordering::Release))
}
pub fn shutdown(&self) -> Result<()> {
@ -93,6 +97,7 @@ impl Server {
}
self.signal("SIGTERM")
.inspect_err(|_| self.stopping.store(false, Ordering::Release))
}
pub fn signal(&self, sig: &'static str) -> Result<()> {