@@ -52,21 +52,12 @@ const DEFAULT_STREAM_WINDOW: u32 = 1024 * 1024 * 2; // 2mb
52
52
const DEFAULT_MAX_FRAME_SIZE : u32 = 1024 * 16 ; // 16kb
53
53
const DEFAULT_MAX_SEND_BUF_SIZE : usize = 1024 * 1024 ; // 1mb
54
54
55
- // The maximum number of concurrent streams that the client is allowed to open
56
- // before it receives the initial SETTINGS frame from the server.
57
- // This default value is derived from what the HTTP/2 spec recommends as the
58
- // minimum value that endpoints advertise to their peers. It means that using
59
- // this value will minimize the chance of the failure where the local endpoint
60
- // attempts to open too many streams and gets rejected by the remote peer with
61
- // the `REFUSED_STREAM` error.
62
- const DEFAULT_INITIAL_MAX_SEND_STREAMS : usize = 100 ;
63
-
64
55
#[ derive( Clone , Debug ) ]
65
56
pub ( crate ) struct Config {
66
57
pub ( crate ) adaptive_window : bool ,
67
58
pub ( crate ) initial_conn_window_size : u32 ,
68
59
pub ( crate ) initial_stream_window_size : u32 ,
69
- pub ( crate ) initial_max_send_streams : usize ,
60
+ pub ( crate ) initial_max_send_streams : Option < usize > ,
70
61
pub ( crate ) max_frame_size : u32 ,
71
62
pub ( crate ) keep_alive_interval : Option < Duration > ,
72
63
pub ( crate ) keep_alive_timeout : Duration ,
@@ -81,7 +72,7 @@ impl Default for Config {
81
72
adaptive_window : false ,
82
73
initial_conn_window_size : DEFAULT_CONN_WINDOW ,
83
74
initial_stream_window_size : DEFAULT_STREAM_WINDOW ,
84
- initial_max_send_streams : DEFAULT_INITIAL_MAX_SEND_STREAMS ,
75
+ initial_max_send_streams : None ,
85
76
max_frame_size : DEFAULT_MAX_FRAME_SIZE ,
86
77
keep_alive_interval : None ,
87
78
keep_alive_timeout : Duration :: from_secs ( 20 ) ,
@@ -95,12 +86,14 @@ impl Default for Config {
95
86
fn new_builder ( config : & Config ) -> Builder {
96
87
let mut builder = Builder :: default ( ) ;
97
88
builder
98
- . initial_max_send_streams ( config. initial_max_send_streams )
99
89
. initial_window_size ( config. initial_stream_window_size )
100
90
. initial_connection_window_size ( config. initial_conn_window_size )
101
91
. max_frame_size ( config. max_frame_size )
102
92
. max_send_buffer_size ( config. max_send_buffer_size )
103
93
. enable_push ( false ) ;
94
+ if let Some ( initial_max_send_streams) = config. initial_max_send_streams {
95
+ builder. initial_max_send_streams ( initial_max_send_streams) ;
96
+ }
104
97
if let Some ( max) = config. max_concurrent_reset_streams {
105
98
builder. max_concurrent_reset_streams ( max) ;
106
99
}
0 commit comments