Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 352403002: Repair the CWND reduction caused by spurious RTO's in QUIC's congestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_unacked_packet_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/test_tools/quic_config_peer.h" 9 #include "net/quic/test_tools/quic_config_peer.h"
10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); 416 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
417 manager_.OnRetransmissionTimeout(); 417 manager_.OnRetransmissionTimeout();
418 EXPECT_TRUE(manager_.HasPendingRetransmissions()); 418 EXPECT_TRUE(manager_.HasPendingRetransmissions());
419 419
420 // Ack 1 but not 2, before 2 is able to be sent. 420 // Ack 1 but not 2, before 2 is able to be sent.
421 // Since 1 has been retransmitted, it has already been lost, and so the 421 // Since 1 has been retransmitted, it has already been lost, and so the
422 // send algorithm is not informed that it has been ACK'd. 422 // send algorithm is not informed that it has been ACK'd.
423 ReceivedPacketInfo received_info; 423 ReceivedPacketInfo received_info;
424 received_info.largest_observed = 1; 424 received_info.largest_observed = 1;
425 ExpectUpdatedRtt(1); 425 ExpectUpdatedRtt(1);
426 EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
426 manager_.OnIncomingAck(received_info, clock_.ApproximateNow()); 427 manager_.OnIncomingAck(received_info, clock_.ApproximateNow());
427 428
428 // Since 2 was marked for retransmit, when 1 is acked, 2 is kept for RTT. 429 // Since 2 was marked for retransmit, when 1 is acked, 2 is kept for RTT.
429 QuicPacketSequenceNumber unacked[] = { 2 }; 430 QuicPacketSequenceNumber unacked[] = { 2 };
430 VerifyUnackedPackets(unacked, arraysize(unacked)); 431 VerifyUnackedPackets(unacked, arraysize(unacked));
431 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); 432 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_));
432 VerifyRetransmittablePackets(NULL, 0); 433 VerifyRetransmittablePackets(NULL, 0);
433 434
434 // Verify that the retransmission alarm would not fire, 435 // Verify that the retransmission alarm would not fire,
435 // since there is no retransmittable data outstanding. 436 // since there is no retransmittable data outstanding.
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 } 1197 }
1197 1198
1198 TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeRTO) { 1199 TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeRTO) {
1199 QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt( 1200 QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt(
1200 QuicTime::Delta::FromMilliseconds(100), 1201 QuicTime::Delta::FromMilliseconds(100),
1201 QuicTime::Delta::Zero(), 1202 QuicTime::Delta::Zero(),
1202 QuicTime::Zero()); 1203 QuicTime::Zero());
1203 1204
1204 SendDataPacket(1); 1205 SendDataPacket(1);
1205 SendDataPacket(2); 1206 SendDataPacket(2);
1207 SendDataPacket(3);
1208 SendDataPacket(4);
1206 1209
1207 QuicTime::Delta expected_rto_delay = QuicTime::Delta::FromMilliseconds(500); 1210 QuicTime::Delta expected_rto_delay = QuicTime::Delta::FromMilliseconds(500);
1208 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()) 1211 EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
1209 .WillRepeatedly(Return(expected_rto_delay)); 1212 .WillRepeatedly(Return(expected_rto_delay));
1210 QuicTime expected_time = clock_.Now().Add(expected_rto_delay); 1213 QuicTime expected_time = clock_.Now().Add(expected_rto_delay);
1211 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); 1214 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
1212 1215
1213 // Retransmit the packet by invoking the retransmission timeout. 1216 // Retransmit the packet by invoking the retransmission timeout.
1214 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); 1217 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1215 clock_.AdvanceTime(expected_rto_delay); 1218 clock_.AdvanceTime(expected_rto_delay);
1216 manager_.OnRetransmissionTimeout(); 1219 manager_.OnRetransmissionTimeout();
1217 RetransmitNextPacket(3); 1220 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(&manager_));
1218 RetransmitNextPacket(4); 1221 RetransmitNextPacket(5);
1219 EXPECT_FALSE(manager_.HasPendingRetransmissions()); 1222 RetransmitNextPacket(6);
1223 EXPECT_EQ(2 * kDefaultLength,
1224 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_));
1225 EXPECT_TRUE(manager_.HasPendingRetransmissions());
1220 1226
1221 // The delay should double the second time. 1227 // The delay should double the second time.
1222 expected_time = clock_.Now().Add(expected_rto_delay).Add(expected_rto_delay); 1228 expected_time = clock_.Now().Add(expected_rto_delay).Add(expected_rto_delay);
1223 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); 1229 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
1224 1230
1225 // Ack a packet and ensure the RTO goes back to the original value. 1231 // Ack a packet and ensure the RTO goes back to the original value.
1226 ReceivedPacketInfo received_info; 1232 ReceivedPacketInfo received_info;
1227 received_info.largest_observed = 2; 1233 received_info.largest_observed = 2;
1228 received_info.missing_packets.insert(1); 1234 received_info.missing_packets.insert(1);
1229 ExpectUpdatedRtt(2); 1235 ExpectUpdatedRtt(2);
1236 EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
1230 manager_.OnIncomingAck(received_info, clock_.ApproximateNow()); 1237 manager_.OnIncomingAck(received_info, clock_.ApproximateNow());
1238 EXPECT_FALSE(manager_.HasPendingRetransmissions());
1239 EXPECT_EQ(4 * kDefaultLength,
1240 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_));
1231 1241
1232 expected_time = clock_.Now().Add(expected_rto_delay); 1242 // Wait 2RTTs from now for the RTO, since it's the max of the RTO time
1243 // and the TLP time. In production, there would always be two TLP's first.
1244 expected_time = clock_.Now().Add(QuicTime::Delta::FromMilliseconds(200));
1233 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); 1245 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
1234 } 1246 }
1235 1247
1236 TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) { 1248 TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) {
1237 SendDataPacket(1); 1249 SendDataPacket(1);
1238 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()) 1250 EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
1239 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1))); 1251 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1)));
1240 QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(200); 1252 QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(200);
1241 1253
1242 // If the delay is smaller than the min, ensure it exponentially backs off 1254 // If the delay is smaller than the min, ensure it exponentially backs off
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1361 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1350 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1362 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1351 manager_.SetFromConfig(config); 1363 manager_.SetFromConfig(config);
1352 1364
1353 EXPECT_TRUE(manager_.using_pacing()); 1365 EXPECT_TRUE(manager_.using_pacing());
1354 } 1366 }
1355 1367
1356 } // namespace 1368 } // namespace
1357 } // namespace test 1369 } // namespace test
1358 } // namespace net 1370 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_unacked_packet_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698