@@ -6,6 +6,7 @@ use std::fmt;
6
6
use bytes:: Bytes ;
7
7
use futures_channel:: mpsc;
8
8
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
9
+ #[ cfg( feature = "client" ) ]
9
10
use futures_channel:: oneshot;
10
11
use futures_core:: Stream ; // for mpsc::Receiver
11
12
#[ cfg( feature = "stream" ) ]
@@ -18,6 +19,7 @@ use super::DecodedLength;
18
19
use crate :: common:: sync_wrapper:: SyncWrapper ;
19
20
use crate :: common:: { task, watch, Pin , Poll } ;
20
21
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
22
+ #[ cfg( feature = "client" ) ]
21
23
use crate :: common:: { Future , Never } ;
22
24
#[ cfg( feature = "http2" ) ]
23
25
use crate :: proto:: h2:: ping;
@@ -72,16 +74,19 @@ struct Extra {
72
74
}
73
75
74
76
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
77
+ #[ cfg( feature = "client" ) ]
75
78
type DelayEofUntil = oneshot:: Receiver < Never > ;
76
79
77
80
enum DelayEof {
78
81
/// Initial state, stream hasn't seen EOF yet.
79
82
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
83
+ #[ cfg( feature = "client" ) ]
80
84
NotEof ( DelayEofUntil ) ,
81
85
/// Transitions to this state once we've seen `poll` try to
82
86
/// return EOF (`None`). This future is then polled, and
83
87
/// when it completes, the Body finally returns EOF (`None`).
84
88
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
89
+ #[ cfg( feature = "client" ) ]
85
90
Eof ( DelayEofUntil ) ,
86
91
}
87
92
@@ -219,6 +224,7 @@ impl Body {
219
224
}
220
225
221
226
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
227
+ #[ cfg( feature = "client" ) ]
222
228
pub ( crate ) fn delayed_eof ( & mut self , fut : DelayEofUntil ) {
223
229
self . extra_mut ( ) . delayed_eof = Some ( DelayEof :: NotEof ( fut) ) ;
224
230
}
@@ -242,6 +248,7 @@ impl Body {
242
248
fn poll_eof ( & mut self , cx : & mut task:: Context < ' _ > ) -> Poll < Option < crate :: Result < Bytes > > > {
243
249
match self . take_delayed_eof ( ) {
244
250
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
251
+ #[ cfg( feature = "client" ) ]
245
252
Some ( DelayEof :: NotEof ( mut delay) ) => match self . poll_inner ( cx) {
246
253
ok @ Poll :: Ready ( Some ( Ok ( ..) ) ) | ok @ Poll :: Pending => {
247
254
self . extra_mut ( ) . delayed_eof = Some ( DelayEof :: NotEof ( delay) ) ;
@@ -258,6 +265,7 @@ impl Body {
258
265
Poll :: Ready ( Some ( Err ( e) ) ) => Poll :: Ready ( Some ( Err ( e) ) ) ,
259
266
} ,
260
267
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
268
+ #[ cfg( feature = "client" ) ]
261
269
Some ( DelayEof :: Eof ( mut delay) ) => match Pin :: new ( & mut delay) . poll ( cx) {
262
270
Poll :: Ready ( Ok ( never) ) => match never { } ,
263
271
Poll :: Pending => {
@@ -266,7 +274,10 @@ impl Body {
266
274
}
267
275
Poll :: Ready ( Err ( _done) ) => Poll :: Ready ( None ) ,
268
276
} ,
269
- #[ cfg( not( any( feature = "http1" , feature = "http2" ) ) ) ]
277
+ #[ cfg( any(
278
+ not( any( feature = "http1" , feature = "http2" ) ) ,
279
+ not( feature = "client" )
280
+ ) ) ]
270
281
Some ( delay_eof) => match delay_eof { } ,
271
282
None => self . poll_inner ( cx) ,
272
283
}
0 commit comments