@@ -90,6 +90,7 @@ pub struct Server<L = Identity> {
90
90
tcp_nodelay : bool ,
91
91
http2_keepalive_interval : Option < Duration > ,
92
92
http2_keepalive_timeout : Option < Duration > ,
93
+ http2_adaptive_window : Option < bool > ,
93
94
max_frame_size : Option < u32 > ,
94
95
accept_http1 : bool ,
95
96
service_builder : ServiceBuilder < L > ,
@@ -110,6 +111,7 @@ impl Default for Server<Identity> {
110
111
tcp_nodelay : false ,
111
112
http2_keepalive_interval : None ,
112
113
http2_keepalive_timeout : None ,
114
+ http2_adaptive_window : None ,
113
115
max_frame_size : None ,
114
116
accept_http1 : false ,
115
117
service_builder : Default :: default ( ) ,
@@ -258,6 +260,17 @@ impl<L> Server<L> {
258
260
}
259
261
}
260
262
263
+ /// Sets whether to use an adaptive flow control. Defaults to false.
264
+ /// Enabling this will override the limits set in http2_initial_stream_window_size and
265
+ /// http2_initial_connection_window_size.
266
+ #[ must_use]
267
+ pub fn http2_adaptive_window ( self , enabled : Option < bool > ) -> Self {
268
+ Server {
269
+ http2_adaptive_window : enabled,
270
+ ..self
271
+ }
272
+ }
273
+
261
274
/// Set whether TCP keepalive messages are enabled on accepted connections.
262
275
///
263
276
/// If `None` is specified, keepalive is disabled, otherwise the duration
@@ -439,6 +452,7 @@ impl<L> Server<L> {
439
452
tcp_nodelay : self . tcp_nodelay ,
440
453
http2_keepalive_interval : self . http2_keepalive_interval ,
441
454
http2_keepalive_timeout : self . http2_keepalive_timeout ,
455
+ http2_adaptive_window : self . http2_adaptive_window ,
442
456
max_frame_size : self . max_frame_size ,
443
457
accept_http1 : self . accept_http1 ,
444
458
}
@@ -476,6 +490,7 @@ impl<L> Server<L> {
476
490
let http2_keepalive_timeout = self
477
491
. http2_keepalive_timeout
478
492
. unwrap_or_else ( || Duration :: new ( DEFAULT_HTTP2_KEEPALIVE_TIMEOUT_SECS , 0 ) ) ;
493
+ let http2_adaptive_window = self . http2_adaptive_window ;
479
494
480
495
let svc = self . service_builder . service ( svc) ;
481
496
@@ -497,6 +512,7 @@ impl<L> Server<L> {
497
512
. http2_max_concurrent_streams ( max_concurrent_streams)
498
513
. http2_keep_alive_interval ( http2_keepalive_interval)
499
514
. http2_keep_alive_timeout ( http2_keepalive_timeout)
515
+ . http2_adaptive_window ( http2_adaptive_window. unwrap_or_default ( ) )
500
516
. http2_max_frame_size ( max_frame_size) ;
501
517
502
518
if let Some ( signal) = signal {
0 commit comments