| 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/congestion_control/general_loss_algorithm.h" | 5 #include "net/quic/congestion_control/general_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" | |
| 11 #include "net/quic/congestion_control/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
| 11 #include "net/quic/quic_flags.h" |
| 12 #include "net/quic/quic_unacked_packet_map.h" | 12 #include "net/quic/quic_unacked_packet_map.h" |
| 13 #include "net/quic/test_tools/mock_clock.h" | 13 #include "net/quic/test_tools/mock_clock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using std::vector; | 16 using std::vector; |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 namespace test { | 19 namespace test { |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1Packet) { | 64 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1Packet) { |
| 65 const size_t kNumSentPackets = 5; | 65 const size_t kNumSentPackets = 5; |
| 66 // Transmit 5 packets. | 66 // Transmit 5 packets. |
| 67 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 67 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 68 SendDataPacket(i); | 68 SendDataPacket(i); |
| 69 } | 69 } |
| 70 // No loss on one ack. | 70 // No loss on one ack. |
| 71 unacked_packets_.RemoveFromInFlight(2); | 71 unacked_packets_.RemoveFromInFlight(2); |
| 72 unacked_packets_.NackPacket(1, 1); | 72 if (!FLAGS_quic_simplify_loss_detection) { |
| 73 unacked_packets_.NackPacket(1, 1); |
| 74 } |
| 73 VerifyLosses(2, nullptr, 0); | 75 VerifyLosses(2, nullptr, 0); |
| 74 // No loss on two acks. | 76 // No loss on two acks. |
| 75 unacked_packets_.RemoveFromInFlight(3); | 77 unacked_packets_.RemoveFromInFlight(3); |
| 76 unacked_packets_.NackPacket(1, 2); | 78 if (!FLAGS_quic_simplify_loss_detection) { |
| 79 unacked_packets_.NackPacket(1, 2); |
| 80 } |
| 77 VerifyLosses(3, nullptr, 0); | 81 VerifyLosses(3, nullptr, 0); |
| 78 // Loss on three acks. | 82 // Loss on three acks. |
| 79 unacked_packets_.RemoveFromInFlight(4); | 83 unacked_packets_.RemoveFromInFlight(4); |
| 80 unacked_packets_.NackPacket(1, 3); | 84 if (!FLAGS_quic_simplify_loss_detection) { |
| 85 unacked_packets_.NackPacket(1, 3); |
| 86 } |
| 81 QuicPacketNumber lost[] = {1}; | 87 QuicPacketNumber lost[] = {1}; |
| 82 VerifyLosses(4, lost, arraysize(lost)); | 88 VerifyLosses(4, lost, arraysize(lost)); |
| 83 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 89 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 84 } | 90 } |
| 85 | 91 |
| 86 // A stretch ack is an ack that covers more than 1 packet of previously | 92 // A stretch ack is an ack that covers more than 1 packet of previously |
| 87 // unacknowledged data. | 93 // unacknowledged data. |
| 88 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1PacketWith1StretchAck) { | 94 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1PacketWith1StretchAck) { |
| 89 const size_t kNumSentPackets = 10; | 95 const size_t kNumSentPackets = 10; |
| 90 // Transmit 10 packets. | 96 // Transmit 10 packets. |
| 91 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 97 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 92 SendDataPacket(i); | 98 SendDataPacket(i); |
| 93 } | 99 } |
| 94 | 100 |
| 95 // Nack the first packet 3 times in a single StretchAck. | 101 // Nack the first packet 3 times in a single StretchAck. |
| 96 unacked_packets_.NackPacket(1, 3); | 102 if (!FLAGS_quic_simplify_loss_detection) { |
| 103 unacked_packets_.NackPacket(1, 3); |
| 104 } |
| 97 unacked_packets_.RemoveFromInFlight(2); | 105 unacked_packets_.RemoveFromInFlight(2); |
| 98 unacked_packets_.RemoveFromInFlight(3); | 106 unacked_packets_.RemoveFromInFlight(3); |
| 99 unacked_packets_.RemoveFromInFlight(4); | 107 unacked_packets_.RemoveFromInFlight(4); |
| 100 QuicPacketNumber lost[] = {1}; | 108 QuicPacketNumber lost[] = {1}; |
| 101 VerifyLosses(4, lost, arraysize(lost)); | 109 VerifyLosses(4, lost, arraysize(lost)); |
| 102 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 110 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 103 } | 111 } |
| 104 | 112 |
| 105 // Ack a packet 3 packets ahead, causing a retransmit. | 113 // Ack a packet 3 packets ahead, causing a retransmit. |
| 106 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1PacketSingleAck) { | 114 TEST_F(GeneralLossAlgorithmTest, NackRetransmit1PacketSingleAck) { |
| 107 const size_t kNumSentPackets = 10; | 115 const size_t kNumSentPackets = 10; |
| 108 // Transmit 10 packets. | 116 // Transmit 10 packets. |
| 109 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 117 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 110 SendDataPacket(i); | 118 SendDataPacket(i); |
| 111 } | 119 } |
| 112 | 120 |
| 113 // Nack the first packet 3 times in an AckFrame with three missing packets. | 121 // Nack the first packet 3 times in an AckFrame with three missing packets. |
| 114 unacked_packets_.NackPacket(1, 3); | 122 if (!FLAGS_quic_simplify_loss_detection) { |
| 115 unacked_packets_.NackPacket(2, 2); | 123 unacked_packets_.NackPacket(1, 3); |
| 116 unacked_packets_.NackPacket(3, 1); | 124 unacked_packets_.NackPacket(2, 2); |
| 125 unacked_packets_.NackPacket(3, 1); |
| 126 } |
| 117 unacked_packets_.RemoveFromInFlight(4); | 127 unacked_packets_.RemoveFromInFlight(4); |
| 118 QuicPacketNumber lost[] = {1}; | 128 QuicPacketNumber lost[] = {1}; |
| 119 VerifyLosses(4, lost, arraysize(lost)); | 129 VerifyLosses(4, lost, arraysize(lost)); |
| 120 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 130 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 121 } | 131 } |
| 122 | 132 |
| 123 TEST_F(GeneralLossAlgorithmTest, EarlyRetransmit1Packet) { | 133 TEST_F(GeneralLossAlgorithmTest, EarlyRetransmit1Packet) { |
| 124 const size_t kNumSentPackets = 2; | 134 const size_t kNumSentPackets = 2; |
| 125 // Transmit 2 packets. | 135 // Transmit 2 packets. |
| 126 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 136 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 127 SendDataPacket(i); | 137 SendDataPacket(i); |
| 128 } | 138 } |
| 129 // Early retransmit when the final packet gets acked and the first is nacked. | 139 // Early retransmit when the final packet gets acked and the first is nacked. |
| 130 unacked_packets_.RemoveFromInFlight(2); | 140 unacked_packets_.RemoveFromInFlight(2); |
| 131 unacked_packets_.NackPacket(1, 1); | 141 if (!FLAGS_quic_simplify_loss_detection) { |
| 142 unacked_packets_.NackPacket(1, 1); |
| 143 } |
| 132 VerifyLosses(2, nullptr, 0); | 144 VerifyLosses(2, nullptr, 0); |
| 133 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt().Multiply(1.25)), | 145 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt().Multiply(1.25)), |
| 134 loss_algorithm_.GetLossTimeout()); | 146 loss_algorithm_.GetLossTimeout()); |
| 135 | 147 |
| 136 clock_.AdvanceTime(rtt_stats_.latest_rtt().Multiply(1.25)); | 148 clock_.AdvanceTime(rtt_stats_.latest_rtt().Multiply(1.25)); |
| 137 QuicPacketNumber lost[] = {1}; | 149 QuicPacketNumber lost[] = {1}; |
| 138 VerifyLosses(2, lost, arraysize(lost)); | 150 VerifyLosses(2, lost, arraysize(lost)); |
| 139 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 151 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 140 } | 152 } |
| 141 | 153 |
| 142 TEST_F(GeneralLossAlgorithmTest, EarlyRetransmitAllPackets) { | 154 TEST_F(GeneralLossAlgorithmTest, EarlyRetransmitAllPackets) { |
| 143 const size_t kNumSentPackets = 5; | 155 const size_t kNumSentPackets = 5; |
| 144 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 156 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 145 SendDataPacket(i); | 157 SendDataPacket(i); |
| 146 // Advance the time 1/4 RTT between 3 and 4. | 158 // Advance the time 1/4 RTT between 3 and 4. |
| 147 if (i == 3) { | 159 if (i == 3) { |
| 148 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); | 160 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); |
| 149 } | 161 } |
| 150 } | 162 } |
| 151 | 163 |
| 152 // Early retransmit when the final packet gets acked and 1.25 RTTs have | 164 // Early retransmit when the final packet gets acked and 1.25 RTTs have |
| 153 // elapsed since the packets were sent. | 165 // elapsed since the packets were sent. |
| 154 unacked_packets_.RemoveFromInFlight(kNumSentPackets); | 166 unacked_packets_.RemoveFromInFlight(kNumSentPackets); |
| 155 // This simulates a single ack following multiple missing packets with FACK. | 167 // This simulates a single ack following multiple missing packets with FACK. |
| 156 for (size_t i = 1; i < kNumSentPackets; ++i) { | 168 if (!FLAGS_quic_simplify_loss_detection) { |
| 157 unacked_packets_.NackPacket(i, kNumSentPackets - i); | 169 for (size_t i = 1; i < kNumSentPackets; ++i) { |
| 170 unacked_packets_.NackPacket(i, kNumSentPackets - i); |
| 171 } |
| 158 } | 172 } |
| 159 QuicPacketNumber lost[] = {1, 2}; | 173 QuicPacketNumber lost[] = {1, 2}; |
| 160 VerifyLosses(kNumSentPackets, lost, arraysize(lost)); | 174 VerifyLosses(kNumSentPackets, lost, arraysize(lost)); |
| 161 // The time has already advanced 1/4 an RTT, so ensure the timeout is set | 175 // 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). | 176 // 1.25 RTTs after the earliest pending packet(3), not the last(4). |
| 163 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt()), | 177 EXPECT_EQ(clock_.Now().Add(rtt_stats_.smoothed_rtt()), |
| 164 loss_algorithm_.GetLossTimeout()); | 178 loss_algorithm_.GetLossTimeout()); |
| 165 | 179 |
| 166 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); | 180 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); |
| 167 QuicPacketNumber lost2[] = {1, 2, 3}; | 181 QuicPacketNumber lost2[] = {1, 2, 3}; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 179 // Transmit 2 packets. | 193 // Transmit 2 packets. |
| 180 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 194 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 181 SendDataPacket(i); | 195 SendDataPacket(i); |
| 182 } | 196 } |
| 183 // Neuter packet 1. | 197 // Neuter packet 1. |
| 184 unacked_packets_.RemoveRetransmittability(1); | 198 unacked_packets_.RemoveRetransmittability(1); |
| 185 | 199 |
| 186 // Early retransmit when the final packet gets acked and the first is nacked. | 200 // Early retransmit when the final packet gets acked and the first is nacked. |
| 187 unacked_packets_.IncreaseLargestObserved(2); | 201 unacked_packets_.IncreaseLargestObserved(2); |
| 188 unacked_packets_.RemoveFromInFlight(2); | 202 unacked_packets_.RemoveFromInFlight(2); |
| 189 unacked_packets_.NackPacket(1, 1); | 203 if (!FLAGS_quic_simplify_loss_detection) { |
| 204 unacked_packets_.NackPacket(1, 1); |
| 205 } |
| 190 VerifyLosses(2, nullptr, 0); | 206 VerifyLosses(2, nullptr, 0); |
| 191 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 207 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 192 } | 208 } |
| 193 | 209 |
| 194 TEST_F(GeneralLossAlgorithmTest, AlwaysLosePacketSent1RTTEarlier) { | 210 TEST_F(GeneralLossAlgorithmTest, AlwaysLosePacketSent1RTTEarlier) { |
| 195 // Transmit 1 packet and then wait an rtt plus 1ms. | 211 // Transmit 1 packet and then wait an rtt plus 1ms. |
| 196 SendDataPacket(1); | 212 SendDataPacket(1); |
| 197 clock_.AdvanceTime( | 213 clock_.AdvanceTime( |
| 198 rtt_stats_.smoothed_rtt().Add(QuicTime::Delta::FromMilliseconds(1))); | 214 rtt_stats_.smoothed_rtt().Add(QuicTime::Delta::FromMilliseconds(1))); |
| 199 | 215 |
| 200 // Transmit 2 packets. | 216 // Transmit 2 packets. |
| 201 SendDataPacket(2); | 217 SendDataPacket(2); |
| 202 SendDataPacket(3); | 218 SendDataPacket(3); |
| 203 | 219 |
| 204 // Wait another RTT and ack 2. | 220 // Wait another RTT and ack 2. |
| 205 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); | 221 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); |
| 206 unacked_packets_.IncreaseLargestObserved(2); | 222 unacked_packets_.IncreaseLargestObserved(2); |
| 207 unacked_packets_.RemoveFromInFlight(2); | 223 unacked_packets_.RemoveFromInFlight(2); |
| 208 unacked_packets_.NackPacket(1, 1); | 224 if (!FLAGS_quic_simplify_loss_detection) { |
| 225 unacked_packets_.NackPacket(1, 1); |
| 226 } |
| 209 QuicPacketNumber lost[] = {1}; | 227 QuicPacketNumber lost[] = {1}; |
| 210 VerifyLosses(2, lost, arraysize(lost)); | 228 VerifyLosses(2, lost, arraysize(lost)); |
| 211 } | 229 } |
| 212 | 230 |
| 213 // Time-based loss detection tests. | 231 // Time-based loss detection tests. |
| 214 TEST_F(GeneralLossAlgorithmTest, NoLossFor500Nacks) { | 232 TEST_F(GeneralLossAlgorithmTest, NoLossFor500Nacks) { |
| 215 loss_algorithm_.SetLossDetectionType(kTime); | 233 loss_algorithm_.SetLossDetectionType(kTime); |
| 216 const size_t kNumSentPackets = 5; | 234 const size_t kNumSentPackets = 5; |
| 217 // Transmit 5 packets. | 235 // Transmit 5 packets. |
| 218 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 236 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 219 SendDataPacket(i); | 237 SendDataPacket(i); |
| 220 } | 238 } |
| 221 unacked_packets_.RemoveFromInFlight(2); | 239 unacked_packets_.RemoveFromInFlight(2); |
| 222 for (size_t i = 1; i < 500; ++i) { | 240 for (size_t i = 1; i < 500; ++i) { |
| 223 unacked_packets_.NackPacket(1, i); | 241 if (!FLAGS_quic_simplify_loss_detection) { |
| 242 unacked_packets_.NackPacket(1, i); |
| 243 } |
| 224 VerifyLosses(2, nullptr, 0); | 244 VerifyLosses(2, nullptr, 0); |
| 225 } | 245 } |
| 226 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(1.25), | 246 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(1.25), |
| 227 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); | 247 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); |
| 228 } | 248 } |
| 229 | 249 |
| 230 TEST_F(GeneralLossAlgorithmTest, NoLossUntilTimeout) { | 250 TEST_F(GeneralLossAlgorithmTest, NoLossUntilTimeout) { |
| 231 loss_algorithm_.SetLossDetectionType(kTime); | 251 loss_algorithm_.SetLossDetectionType(kTime); |
| 232 const size_t kNumSentPackets = 10; | 252 const size_t kNumSentPackets = 10; |
| 233 // Transmit 10 packets at 1/10th an RTT interval. | 253 // Transmit 10 packets at 1/10th an RTT interval. |
| 234 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 254 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 235 SendDataPacket(i); | 255 SendDataPacket(i); |
| 236 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.1)); | 256 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.1)); |
| 237 } | 257 } |
| 238 // Expect the timer to not be set. | 258 // Expect the timer to not be set. |
| 239 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 259 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 240 // The packet should not be lost until 1.25 RTTs pass. | 260 // The packet should not be lost until 1.25 RTTs pass. |
| 241 unacked_packets_.NackPacket(1, 1); | 261 if (!FLAGS_quic_simplify_loss_detection) { |
| 262 unacked_packets_.NackPacket(1, 1); |
| 263 } |
| 242 unacked_packets_.RemoveFromInFlight(2); | 264 unacked_packets_.RemoveFromInFlight(2); |
| 243 VerifyLosses(2, nullptr, 0); | 265 VerifyLosses(2, nullptr, 0); |
| 244 // Expect the timer to be set to 0.25 RTT's in the future. | 266 // Expect the timer to be set to 0.25 RTT's in the future. |
| 245 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(0.25), | 267 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(0.25), |
| 246 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); | 268 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); |
| 247 unacked_packets_.NackPacket(1, 5); | 269 if (!FLAGS_quic_simplify_loss_detection) { |
| 270 unacked_packets_.NackPacket(1, 5); |
| 271 } |
| 248 VerifyLosses(2, nullptr, 0); | 272 VerifyLosses(2, nullptr, 0); |
| 249 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); | 273 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); |
| 250 QuicPacketNumber lost[] = {1}; | 274 QuicPacketNumber lost[] = {1}; |
| 251 VerifyLosses(2, lost, arraysize(lost)); | 275 VerifyLosses(2, lost, arraysize(lost)); |
| 252 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 276 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 253 } | 277 } |
| 254 | 278 |
| 255 TEST_F(GeneralLossAlgorithmTest, NoLossWithoutNack) { | 279 TEST_F(GeneralLossAlgorithmTest, NoLossWithoutNack) { |
| 256 loss_algorithm_.SetLossDetectionType(kTime); | 280 loss_algorithm_.SetLossDetectionType(kTime); |
| 257 const size_t kNumSentPackets = 10; | 281 const size_t kNumSentPackets = 10; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 279 loss_algorithm_.SetLossDetectionType(kTime); | 303 loss_algorithm_.SetLossDetectionType(kTime); |
| 280 const size_t kNumSentPackets = 10; | 304 const size_t kNumSentPackets = 10; |
| 281 // Transmit 10 packets at once and then go forward an RTT. | 305 // Transmit 10 packets at once and then go forward an RTT. |
| 282 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 306 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 283 SendDataPacket(i); | 307 SendDataPacket(i); |
| 284 } | 308 } |
| 285 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); | 309 clock_.AdvanceTime(rtt_stats_.smoothed_rtt()); |
| 286 // Expect the timer to not be set. | 310 // Expect the timer to not be set. |
| 287 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 311 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 288 // The packet should not be lost until 1.25 RTTs pass. | 312 // The packet should not be lost until 1.25 RTTs pass. |
| 289 for (size_t i = 1; i < kNumSentPackets; ++i) { | 313 if (!FLAGS_quic_simplify_loss_detection) { |
| 290 unacked_packets_.NackPacket(i, 1); | 314 for (size_t i = 1; i < kNumSentPackets; ++i) { |
| 315 unacked_packets_.NackPacket(i, 1); |
| 316 } |
| 291 } | 317 } |
| 292 unacked_packets_.RemoveFromInFlight(10); | 318 unacked_packets_.RemoveFromInFlight(10); |
| 293 VerifyLosses(10, nullptr, 0); | 319 VerifyLosses(10, nullptr, 0); |
| 294 // Expect the timer to be set to 0.25 RTT's in the future. | 320 // Expect the timer to be set to 0.25 RTT's in the future. |
| 295 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(0.25), | 321 EXPECT_EQ(rtt_stats_.smoothed_rtt().Multiply(0.25), |
| 296 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); | 322 loss_algorithm_.GetLossTimeout().Subtract(clock_.Now())); |
| 297 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); | 323 clock_.AdvanceTime(rtt_stats_.smoothed_rtt().Multiply(0.25)); |
| 298 QuicPacketNumber lost[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | 324 QuicPacketNumber lost[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; |
| 299 VerifyLosses(10, lost, arraysize(lost)); | 325 VerifyLosses(10, lost, arraysize(lost)); |
| 300 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); | 326 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
| 301 } | 327 } |
| 302 | 328 |
| 303 } // namespace | 329 } // namespace |
| 304 } // namespace test | 330 } // namespace test |
| 305 } // namespace net | 331 } // namespace net |
| OLD | NEW |