Skip to content

Commit

Permalink
add poll_frame, delete poll_trailers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludea authored and ikrivosheev committed Jan 10, 2024
1 parent cd05673 commit 46ee628
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 46ee628

Please sign in to comment.