Properly shut down protocols handler on useless timeout (#892)

This commit is contained in:
Pierre Krieger
2019-01-25 15:56:32 +01:00
committed by GitHub
parent 18db0e806b
commit 30c082dfe5

View File

@ -289,6 +289,7 @@ where
// Poll the handler at the end so that we see the consequences of the method calls on // Poll the handler at the end so that we see the consequences of the method calls on
// `self.handler`. // `self.handler`.
loop {
let poll_result = self.handler.poll()?; let poll_result = self.handler.poll()?;
if self.handler.connection_keep_alive() { if self.handler.connection_keep_alive() {
@ -324,7 +325,8 @@ where
if self.negotiating_in.is_empty() && self.negotiating_out.is_empty() { if self.negotiating_in.is_empty() && self.negotiating_out.is_empty() {
match connection_shutdown.poll() { match connection_shutdown.poll() {
Ok(Async::Ready(_)) | Err(_) => { Ok(Async::Ready(_)) | Err(_) => {
return Ok(Async::Ready(NodeHandlerEvent::Shutdown)) self.shutdown();
continue; // We need to poll the handler again.
}, },
Ok(Async::NotReady) => { Ok(Async::NotReady) => {
self.connection_shutdown = Some(connection_shutdown); self.connection_shutdown = Some(connection_shutdown);
@ -335,6 +337,9 @@ where
} }
} }
break;
}
Ok(Async::NotReady) Ok(Async::NotReady)
} }
} }