File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -874,6 +874,7 @@ impl<'a> Socket<'a> {
874
874
fn reset ( & mut self ) {
875
875
let rx_cap_log2 =
876
876
mem:: size_of :: < usize > ( ) * 8 - self . rx_buffer . capacity ( ) . leading_zeros ( ) as usize ;
877
+ let new_rx_win_shift = rx_cap_log2. saturating_sub ( 16 ) as u8 ;
877
878
878
879
self . state = State :: Closed ;
879
880
self . timer = Timer :: new ( ) ;
@@ -891,7 +892,10 @@ impl<'a> Socket<'a> {
891
892
self . remote_last_win = 0 ;
892
893
self . remote_win_len = 0 ;
893
894
self . remote_win_scale = None ;
894
- self . remote_win_shift = rx_cap_log2. saturating_sub ( 16 ) as u8 ;
895
+ // keep user-specified window scaling across connect()/listen()
896
+ if self . remote_win_shift < new_rx_win_shift {
897
+ self . remote_win_shift = new_rx_win_shift;
898
+ }
895
899
self . remote_mss = DEFAULT_MSS ;
896
900
self . remote_last_ts = None ;
897
901
self . ack_delay_timer = AckDelayTimer :: Idle ;
@@ -2339,6 +2343,7 @@ impl<'a> Socket<'a> {
2339
2343
} else if self . timer . should_close ( cx. now ( ) ) {
2340
2344
// If we have spent enough time in the TIME-WAIT state, close the socket.
2341
2345
tcp_trace ! ( "TIME-WAIT timer expired" ) ;
2346
+ self . remote_win_shift = 0 ;
2342
2347
self . reset ( ) ;
2343
2348
return Ok ( ( ) ) ;
2344
2349
} else {
You can’t perform that action at this time.
0 commit comments