OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/core/congestion_control/general_loss_algorithm.h" | 5 #include "net/quic/core/congestion_control/general_loss_algorithm.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdint> | 8 #include <cstdint> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 QuicPacketNumber lost[] = {1}; | 430 QuicPacketNumber lost[] = {1}; |
431 VerifyLosses(2, lost, arraysize(lost)); | 431 VerifyLosses(2, lost, arraysize(lost)); |
432 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 432 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
433 // Retransmit packet 1 as 11 and 2 as 12. | 433 // Retransmit packet 1 as 11 and 2 as 12. |
434 SendDataPacket(11); | 434 SendDataPacket(11); |
435 SendDataPacket(12); | 435 SendDataPacket(12); |
436 | 436 |
437 // Advance the time 1/4 RTT and indicate the loss was spurious. | 437 // Advance the time 1/4 RTT and indicate the loss was spurious. |
438 // The new threshold should be 1/2 RTT. | 438 // The new threshold should be 1/2 RTT. |
439 clock_.AdvanceTime(rtt_stats_.smoothed_rtt() * (1.0f / 4)); | 439 clock_.AdvanceTime(rtt_stats_.smoothed_rtt() * (1.0f / 4)); |
| 440 if (FLAGS_quic_reloadable_flag_quic_fix_adaptive_time_loss) { |
| 441 // The flag fixes an issue where adaptive time loss would increase the |
| 442 // reordering threshold by an extra factor of two. |
| 443 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1)); |
| 444 } |
440 loss_algorithm_.SpuriousRetransmitDetected(unacked_packets_, clock_.Now(), | 445 loss_algorithm_.SpuriousRetransmitDetected(unacked_packets_, clock_.Now(), |
441 rtt_stats_, 11); | 446 rtt_stats_, 11); |
442 EXPECT_EQ(1, loss_algorithm_.reordering_shift()); | 447 EXPECT_EQ(1, loss_algorithm_.reordering_shift()); |
443 | 448 |
444 // Detect another spurious retransmit and ensure the threshold doesn't | 449 // Detect another spurious retransmit and ensure the threshold doesn't |
445 // increase again. | 450 // increase again. |
446 loss_algorithm_.SpuriousRetransmitDetected(unacked_packets_, clock_.Now(), | 451 loss_algorithm_.SpuriousRetransmitDetected(unacked_packets_, clock_.Now(), |
447 rtt_stats_, 12); | 452 rtt_stats_, 12); |
448 EXPECT_EQ(1, loss_algorithm_.reordering_shift()); | 453 EXPECT_EQ(1, loss_algorithm_.reordering_shift()); |
449 } | 454 } |
450 | 455 |
451 } // namespace | 456 } // namespace |
452 } // namespace test | 457 } // namespace test |
453 } // namespace net | 458 } // namespace net |
OLD | NEW |