mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 15:21:33 +00:00
Don't allow handlers::poll() to return None (#811)
This commit is contained in:
@ -497,9 +497,7 @@ where
|
||||
fn poll(
|
||||
&mut self,
|
||||
) -> Poll<
|
||||
Option<
|
||||
ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>,
|
||||
>,
|
||||
ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>,
|
||||
io::Error,
|
||||
> {
|
||||
// Special case if shutting down.
|
||||
@ -512,7 +510,7 @@ where
|
||||
}
|
||||
|
||||
if self.substreams.is_empty() {
|
||||
return Ok(Async::Ready(None));
|
||||
return Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown));
|
||||
} else {
|
||||
return Ok(Async::NotReady);
|
||||
}
|
||||
@ -526,10 +524,10 @@ where
|
||||
match advance_substream(substream, self.config) {
|
||||
(Some(new_state), Some(event), _) => {
|
||||
self.substreams.push(new_state);
|
||||
return Ok(Async::Ready(Some(event)));
|
||||
return Ok(Async::Ready(event));
|
||||
}
|
||||
(None, Some(event), _) => {
|
||||
return Ok(Async::Ready(Some(event)));
|
||||
return Ok(Async::Ready(event));
|
||||
}
|
||||
(Some(new_state), None, false) => {
|
||||
self.substreams.push(new_state);
|
||||
|
Reference in New Issue
Block a user