11use crate :: stream_label:: { LabelSet , MkStreamLabel , StreamLabel } ;
22use http_body:: Body ;
33use linkerd_error:: Error ;
4+ use linkerd_http_body_eos:: EosRef ;
45use linkerd_http_box:: BoxBody ;
56use linkerd_stack as svc;
67use prometheus_client:: metrics:: {
@@ -180,15 +181,15 @@ where
180181
181182 let ( head, inner) = rsp. into_parts ( ) ;
182183 if inner. is_end_stream ( ) {
183- end_stream ( & mut state, Ok ( None ) ) ;
184+ end_stream ( & mut state, EosRef :: None ) ;
184185 }
185186 Poll :: Ready ( Ok ( http:: Response :: from_parts (
186187 head,
187188 BoxBody :: new ( ResponseBody { inner, state } ) ,
188189 ) ) )
189190 }
190191 Err ( error) => {
191- end_stream ( & mut state, Err ( & error) ) ;
192+ end_stream ( & mut state, EosRef :: Error ( & error) ) ;
192193 Poll :: Ready ( Err ( error) )
193194 }
194195 }
@@ -217,14 +218,14 @@ where
217218
218219 match & frame {
219220 Some ( Ok ( frame) ) => {
220- if let trls @ Some ( _ ) = frame. trailers_ref ( ) {
221- end_stream ( this. state , Ok ( trls) ) ;
221+ if let Some ( trls ) = frame. trailers_ref ( ) {
222+ end_stream ( this. state , EosRef :: Trailers ( trls) ) ;
222223 } else if this. inner . is_end_stream ( ) {
223- end_stream ( this. state , Ok ( None ) ) ;
224+ end_stream ( this. state , EosRef :: None ) ;
224225 }
225226 }
226- Some ( Err ( error) ) => end_stream ( this. state , Err ( error) ) ,
227- None => end_stream ( this. state , Ok ( None ) ) ,
227+ Some ( Err ( error) ) => end_stream ( this. state , EosRef :: Error ( error) ) ,
228+ None => end_stream ( this. state , EosRef :: None ) ,
228229 }
229230
230231 Poll :: Ready ( frame)
@@ -246,15 +247,13 @@ where
246247 fn drop ( self : Pin < & mut Self > ) {
247248 let this = self . project ( ) ;
248249 if this. state . is_some ( ) {
249- end_stream ( this. state , Err ( & RequestCancelled . into ( ) ) ) ;
250+ end_stream ( this. state , EosRef :: Cancelled ) ;
250251 }
251252 }
252253}
253254
254- fn end_stream < L > (
255- state : & mut Option < ResponseState < L > > ,
256- res : Result < Option < & http:: HeaderMap > , & Error > ,
257- ) where
255+ fn end_stream < L > ( state : & mut Option < ResponseState < L > > , res : EosRef < ' _ > )
256+ where
258257 L : StreamLabel ,
259258 L :: DurationLabels : LabelSet ,
260259{
0 commit comments