Skip to content

Commit

Permalink
fixup! Re-design the StreamMuxer trait
Browse files Browse the repository at this point in the history
Favor local work over remote work.
  • Loading branch information
thomaseizinger committed Jun 3, 2022
1 parent ad34171 commit e9506aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions muxers/mplex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ where
&mut self,
cx: &mut Context<'_>,
) -> Poll<io::Result<StreamMuxerEvent<Self::Substream>>> {
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))?
Expand All @@ -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
}

Expand Down

0 comments on commit e9506aa

Please sign in to comment.