@@ -77,7 +77,7 @@ const DEFAULT_SPLIT_SEND_SIZE: usize = 16 * 1024;
7777#[ derive( Debug , Clone ) ]
7878pub struct Config {
7979 // TODO: Rename to max_stream_receive_window
80- receive_window : usize ,
80+ receive_window : Option < usize > ,
8181 // TODO: Rename to max_connection_receive_window
8282 connection_window : usize ,
8383 max_buffer_size : usize ,
@@ -89,7 +89,8 @@ pub struct Config {
8989impl Default for Config {
9090 fn default ( ) -> Self {
9191 Config {
92- receive_window : 16 * 1024 * 1024 ,
92+ // TODO: Add rational: given that we have a connection window, ...
93+ receive_window : None ,
9394 // TODO: reevaluate default.
9495 // TODO: Add setter.
9596 connection_window : 1 * 1024 * 1024 * 1024 ,
@@ -108,12 +109,12 @@ impl Config {
108109 /// # Panics
109110 ///
110111 /// If the given receive window is < 256 KiB.
111- pub fn set_receive_window ( & mut self , n : usize ) -> & mut Self {
112+ pub fn set_receive_window ( & mut self , n : Option < usize > ) -> & mut Self {
112113 self . receive_window = n;
113114 self . check ( ) ;
114115 self
115116 }
116-
117+
117118 pub fn set_connection_window ( & mut self , n : usize ) -> & mut Self {
118119 self . connection_window = n;
119120 self . check ( ) ;
@@ -150,8 +151,9 @@ impl Config {
150151 self
151152 }
152153
154+ // TODO: Consider doing the check on creation, not on each builder method call.
153155 fn check ( & self ) {
154- assert ! ( self . receive_window >= DEFAULT_CREDIT ) ;
156+ assert ! ( self . receive_window. unwrap_or ( usize :: MAX ) >= DEFAULT_CREDIT ) ;
155157 assert ! ( self . connection_window >= self . max_num_streams * DEFAULT_CREDIT ) ;
156158 }
157159}
0 commit comments