@@ -6413,6 +6413,38 @@ mod test {
6413
6413
recv_nothing ! ( s) ;
6414
6414
}
6415
6415
6416
+ #[ test]
6417
+ fn test_retransmit_exponential_backoff ( ) {
6418
+ let mut s = socket_established ( ) ;
6419
+ s. send_slice ( b"abcdef" ) . unwrap ( ) ;
6420
+ recv ! ( s, time 0 , Ok ( TcpRepr {
6421
+ seq_number: LOCAL_SEQ + 1 ,
6422
+ ack_number: Some ( REMOTE_SEQ + 1 ) ,
6423
+ payload: & b"abcdef" [ ..] ,
6424
+ ..RECV_TEMPL
6425
+ } ) ) ;
6426
+
6427
+ let expected_retransmission_instant = s. rtte . retransmission_timeout ( ) . total_millis ( ) as i64 ;
6428
+ recv_nothing ! ( s, time expected_retransmission_instant - 1 ) ;
6429
+ recv ! ( s, time expected_retransmission_instant, Ok ( TcpRepr {
6430
+ seq_number: LOCAL_SEQ + 1 ,
6431
+ ack_number: Some ( REMOTE_SEQ + 1 ) ,
6432
+ payload: & b"abcdef" [ ..] ,
6433
+ ..RECV_TEMPL
6434
+ } ) ) ;
6435
+
6436
+ // "current time" is expected_retransmission_instant, and we want to wait 2 * retransmission timeout
6437
+ let expected_retransmission_instant = 3 * expected_retransmission_instant;
6438
+
6439
+ recv_nothing ! ( s, time expected_retransmission_instant - 1 ) ;
6440
+ recv ! ( s, time expected_retransmission_instant, Ok ( TcpRepr {
6441
+ seq_number: LOCAL_SEQ + 1 ,
6442
+ ack_number: Some ( REMOTE_SEQ + 1 ) ,
6443
+ payload: & b"abcdef" [ ..] ,
6444
+ ..RECV_TEMPL
6445
+ } ) ) ;
6446
+ }
6447
+
6416
6448
// =========================================================================================//
6417
6449
// Tests for window management.
6418
6450
// =========================================================================================//
0 commit comments