From 0b8a3cc33a7f30fb20f35fcf0fe84d25300199a3 Mon Sep 17 00:00:00 2001 From: Ludea Date: Tue, 19 Dec 2023 06:43:16 +0000 Subject: [PATCH] add poll_frame, delete poll_trailers --- tonic/src/transport/server/recover_error.rs | 24 ++++++--------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/tonic/src/transport/server/recover_error.rs b/tonic/src/transport/server/recover_error.rs index 6d7e55bf4..20c583aac 100644 --- a/tonic/src/transport/server/recover_error.rs +++ b/tonic/src/transport/server/recover_error.rs @@ -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>> { - match self.project().inner.as_pin_mut() { - Some(b) => b.poll_data(cx), - None => Poll::Ready(None), - } + ) -> Poll, Self::Error>>> { + Pin::new(&mut self.0).poll_frame(cx) } - fn poll_trailers( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll, 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() } }