| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/congestion_control/tcp_loss_algorithm.h" | 5 #include "net/quic/congestion_control/tcp_loss_algorithm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (i == 3) { | 147 if (i == 3) { |
| 148 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); | 148 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Early retransmit when the final packet gets acked and 1.25 RTTs have | 152 // Early retransmit when the final packet gets acked and 1.25 RTTs have |
| 153 // elapsed since the packets were sent. | 153 // elapsed since the packets were sent. |
| 154 unacked_packets_.RemoveFromInFlight(kNumSentPackets); | 154 unacked_packets_.RemoveFromInFlight(kNumSentPackets); |
| 155 // This simulates a single ack following multiple missing packets with FACK. | 155 // This simulates a single ack following multiple missing packets with FACK. |
| 156 for (size_t i = 1; i < kNumSentPackets; ++i) { | 156 for (size_t i = 1; i < kNumSentPackets; ++i) { |
| 157 unacked_packets_.NackPacket(i, kNumSentPackets - i); | 157 unacked_packets_.NackPacket(i, static_cast<uint16>(kNumSentPackets - i)); |
| 158 } | 158 } |
| 159 QuicPacketNumber lost[] = {1, 2}; | 159 QuicPacketNumber lost[] = {1, 2}; |
| 160 VerifyLosses(kNumSentPackets, lost, arraysize(lost)); | 160 VerifyLosses(kNumSentPackets, lost, arraysize(lost)); |
| 161 // The time has already advanced 1/4 an RTT, so ensure the timeout is set | 161 // The time has already advanced 1/4 an RTT, so ensure the timeout is set |
| 162 // 1.25 RTTs after the earliest pending packet(3), not the last(4). | 162 // 1.25 RTTs after the earliest pending packet(3), not the last(4). |
| 163 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt()), | 163 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt()), |
| 164 loss_algorithm_.GetLossTimeout()); | 164 loss_algorithm_.GetLossTimeout()); |
| 165 | 165 |
| 166 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); | 166 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); |
| 167 QuicPacketNumber lost2[] = {1, 2, 3}; | 167 QuicPacketNumber lost2[] = {1, 2, 3}; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 unacked_packets_.IncreaseLargestObserved(2); | 206 unacked_packets_.IncreaseLargestObserved(2); |
| 207 unacked_packets_.RemoveFromInFlight(2); | 207 unacked_packets_.RemoveFromInFlight(2); |
| 208 unacked_packets_.NackPacket(1, 1); | 208 unacked_packets_.NackPacket(1, 1); |
| 209 QuicPacketNumber lost[] = {1}; | 209 QuicPacketNumber lost[] = {1}; |
| 210 VerifyLosses(2, lost, arraysize(lost)); | 210 VerifyLosses(2, lost, arraysize(lost)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace | 213 } // namespace |
| 214 } // namespace test | 214 } // namespace test |
| 215 } // namespace net | 215 } // namespace net |
| OLD | NEW |