File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -856,6 +856,7 @@ impl<'a> Socket<'a> {
856
856
fn reset ( & mut self ) {
857
857
let rx_cap_log2 =
858
858
mem:: size_of :: < usize > ( ) * 8 - self . rx_buffer . capacity ( ) . leading_zeros ( ) as usize ;
859
+ let new_rx_win_shift = rx_cap_log2. saturating_sub ( 16 ) as u8 ;
859
860
860
861
self . state = State :: Closed ;
861
862
self . timer = Timer :: new ( ) ;
@@ -873,7 +874,10 @@ impl<'a> Socket<'a> {
873
874
self . remote_last_win = 0 ;
874
875
self . remote_win_len = 0 ;
875
876
self . remote_win_scale = None ;
876
- self . remote_win_shift = rx_cap_log2. saturating_sub ( 16 ) as u8 ;
877
+ // keep user-specified window scaling across connect()/listen()
878
+ if self . remote_win_shift < new_rx_win_shift {
879
+ self . remote_win_shift = new_rx_win_shift;
880
+ }
877
881
self . remote_mss = DEFAULT_MSS ;
878
882
self . remote_last_ts = None ;
879
883
self . ack_delay_timer = AckDelayTimer :: Idle ;
@@ -2308,6 +2312,7 @@ impl<'a> Socket<'a> {
2308
2312
} else if self . timer . should_close ( cx. now ( ) ) {
2309
2313
// If we have spent enough time in the TIME-WAIT state, close the socket.
2310
2314
tcp_trace ! ( "TIME-WAIT timer expired" ) ;
2315
+ self . remote_win_shift = 0 ;
2311
2316
self . reset ( ) ;
2312
2317
return Ok ( ( ) ) ;
2313
2318
} else {
You can’t perform that action at this time.
0 commit comments