Skip to content

Commit

Permalink
chore(core): fine tune pull frame from IncomingBody
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Dec 14, 2023
1 parent ab39e26 commit ce037d1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions viz-core/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ impl Body for IncomingBody {
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
match self.get_mut() {
Self::Empty | Self::Incoming(None) => Poll::Ready(None),
Self::Incoming(s) => {
match Pin::new(s.as_mut().unwrap()).poll_frame(cx)? {
Self::Empty => Poll::Ready(None),
Self::Incoming(i) => match i {
None => Poll::Ready(None),
Some(b) => match Pin::new(b).poll_frame(cx)? {
Poll::Ready(Some(f)) => Poll::Ready(Some(Ok(f))),
Poll::Ready(None) => {
// the body has been used.
*s = None;
*i = None;
Poll::Ready(None)
}
Poll::Pending => Poll::Pending,
}
}
},
},
}
}

Expand Down

0 comments on commit ce037d1

Please sign in to comment.