return from Main loop on Ctrl-C/shutdown

This commit is contained in:
Reinier Balt 2018-04-30 14:21:49 +02:00
parent 59cff3d4c5
commit 6a4e9e8bec

View file

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