mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +00:00
Minor opti poll Fuse (#946)
This commit is contained in:
@ -146,16 +146,15 @@ where
|
||||
ProtocolsHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::OutEvent>,
|
||||
Self::Error,
|
||||
> {
|
||||
if let Some(mut inner) = self.inner.take() {
|
||||
let poll = inner.poll();
|
||||
if let Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)) = poll {
|
||||
poll
|
||||
} else {
|
||||
self.inner = Some(inner);
|
||||
poll
|
||||
}
|
||||
} else {
|
||||
Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown))
|
||||
let poll = match self.inner.as_mut() {
|
||||
Some(i) => i.poll(),
|
||||
None => return Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)),
|
||||
};
|
||||
|
||||
if let Ok(Async::Ready(ProtocolsHandlerEvent::Shutdown)) = poll {
|
||||
self.inner = None;
|
||||
}
|
||||
|
||||
poll
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user