From e9506aae7048184e90ceabd4dcbad3f07126308d Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 3 Jun 2022 18:24:15 +0200 Subject: [PATCH] fixup! Re-design the `StreamMuxer` trait Favor local work over remote work. --- muxers/mplex/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/muxers/mplex/src/lib.rs b/muxers/mplex/src/lib.rs index 36a75db4fac1..50d9c812ce00 100644 --- a/muxers/mplex/src/lib.rs +++ b/muxers/mplex/src/lib.rs @@ -97,12 +97,6 @@ where &mut self, cx: &mut Context<'_>, ) -> Poll>> { - if let Poll::Ready(mplex_id) = self.io.lock().poll_next_stream(cx)? { - let substream = Substream::new(mplex_id, self.io.clone()); - - return Poll::Ready(Ok(StreamMuxerEvent::InboundSubstream(substream))); - } - if let Poll::Ready((mplex_id, outbound_id)) = self .outbound_substreams .poll(|| Pin::new(&mut self.io.lock()).poll_open_stream(cx))? @@ -115,6 +109,12 @@ where ))); } + if let Poll::Ready(mplex_id) = self.io.lock().poll_next_stream(cx)? { + let substream = Substream::new(mplex_id, self.io.clone()); + + return Poll::Ready(Ok(StreamMuxerEvent::InboundSubstream(substream))); + } + Poll::Pending }