mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 18:11:22 +00:00
Properly shut down protocols handler on useless timeout (#892)
This commit is contained in:
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user