Merge pull request #212 from lrbalt/shutdown

return from Main loop on Ctrl-C/shutdown
This commit is contained in:
Sasha Hilton 2018-04-30 15:46:12 +02:00 committed by GitHub
commit 92835af007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -434,6 +434,7 @@ impl Future for Main {
} }
if let Async::Ready(Some(())) = self.signal.poll().unwrap() { if let Async::Ready(Some(())) = self.signal.poll().unwrap() {
trace!("Ctrl-C received");
if !self.shutdown { if !self.shutdown {
if let Some(ref spirc) = self.spirc { if let Some(ref spirc) = self.spirc {
spirc.shutdown(); spirc.shutdown();
@ -467,6 +468,10 @@ impl Future for Main {
if !progress { if !progress {
return Ok(Async::NotReady); return Ok(Async::NotReady);
} }
if self.shutdown {
return Ok(Async::Ready(()));
}
} }
} }
} }