Skip to content

Commit

Permalink
Merge remote-tracking branch 'Ludea/poll_trailers' into hyper-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrivosheev committed Jan 10, 2024
2 parents ff0b124 + 0b8a3cc commit 2c1e04c
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions tonic/src/transport/server/recover_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,18 @@ where
type Data = B::Data;
type Error = B::Error;

fn poll_data(
fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Data, Self::Error>>> {
match self.project().inner.as_pin_mut() {
Some(b) => b.poll_data(cx),
None => Poll::Ready(None),
}
) -> Poll<Option<Result<http_body::Frame<Self::Data>, Self::Error>>> {
Pin::new(&mut self.0).poll_frame(cx)
}

fn poll_trailers(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Option<http::HeaderMap>, Self::Error>> {
match self.project().inner.as_pin_mut() {
Some(b) => b.poll_trailers(cx),
None => Poll::Ready(Ok(None)),
}
fn size_hint(&self) -> http_body::SizeHint {
self.0.size_hint()
}

fn is_end_stream(&self) -> bool {
match &self.inner {
Some(b) => b.is_end_stream(),
None => true,
}
self.body.is_end_stream()
}
}

0 comments on commit 2c1e04c

Please sign in to comment.