Skip to content

Commit

Permalink
Merge pull request #1 from Ludea/poll_trailers
Browse files Browse the repository at this point in the history
add poll_frame, delete poll_trailers
  • Loading branch information
allan2 authored Jan 22, 2024
2 parents 52d6bc5 + 0b8a3cc commit 9334fb8
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 9334fb8

Please sign in to comment.