Remove TLP and RTO retransmissions by deprecating gfe2_restart_flag_quic_default_on_pto2.
PiperOrigin-RevId: 445670173
diff --git a/quiche/quic/core/http/quic_spdy_session_test.cc b/quiche/quic/core/http/quic_spdy_session_test.cc
index 283fdf5..a8fb322 100644
--- a/quiche/quic/core/http/quic_spdy_session_test.cc
+++ b/quiche/quic/core/http/quic_spdy_session_test.cc
@@ -2172,7 +2172,7 @@
EXPECT_CALL(*stream6, RetransmitStreamData(_, _, _, _))
.WillOnce(Return(true));
EXPECT_CALL(*send_algorithm, OnApplicationLimited(_));
- session_.RetransmitFrames(frames, TLP_RETRANSMISSION);
+ session_.RetransmitFrames(frames, PTO_RETRANSMISSION);
}
TEST_P(QuicSpdySessionTestServer, OnPriorityFrame) {
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index 4ce6658..1d134b5 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -617,12 +617,10 @@
if (config.HasClientSentConnectionOption(k5RTO, perspective_)) {
num_rtos_for_blackhole_detection_ = 5;
}
- if (sent_packet_manager_.pto_enabled()) {
- if (config.HasClientSentConnectionOption(k6PTO, perspective_) ||
- config.HasClientSentConnectionOption(k7PTO, perspective_) ||
- config.HasClientSentConnectionOption(k8PTO, perspective_)) {
- num_rtos_for_blackhole_detection_ = 5;
- }
+ if (config.HasClientSentConnectionOption(k6PTO, perspective_) ||
+ config.HasClientSentConnectionOption(k7PTO, perspective_) ||
+ config.HasClientSentConnectionOption(k8PTO, perspective_)) {
+ num_rtos_for_blackhole_detection_ = 5;
}
if (config.HasClientSentConnectionOption(kNSTP, perspective_)) {
no_stop_waiting_frames_ = true;
@@ -4138,11 +4136,8 @@
packet_creator_.packet_number();
const auto retransmission_mode =
sent_packet_manager_.OnRetransmissionTimeout();
- if (sent_packet_manager_.skip_packet_number_for_pto() &&
- retransmission_mode == QuicSentPacketManager::PTO_MODE &&
- sent_packet_manager_.pending_timer_transmission_count() == 1) {
- // Skip a packet number when a single PTO packet is sent to elicit an
- // immediate ACK.
+ if (retransmission_mode == QuicSentPacketManager::PTO_MODE) {
+ // Skip a packet number when PTO fires to elicit an immediate ACK.
const QuicPacketCount num_packet_numbers_to_skip = 1;
packet_creator_.SkipNPacketNumbers(
num_packet_numbers_to_skip,
@@ -4168,23 +4163,14 @@
if (!connected_) {
return;
}
-
- // In the PTO and TLP cases, the SentPacketManager gives the connection the
- // opportunity to send new data before retransmitting.
- if (sent_packet_manager_.pto_enabled()) {
- sent_packet_manager_.MaybeSendProbePackets();
- } else if (sent_packet_manager_.MaybeRetransmitTailLossProbe()) {
- // Send the pending retransmission now that it's been queued.
- WriteIfNotBlocked();
- }
+ // When PTO fires, the SentPacketManager gives the connection the opportunity
+ // to send new data before retransmitting.
+ sent_packet_manager_.MaybeSendProbePacket();
if (packet_creator_.packet_number() == previous_created_packet_number &&
- (retransmission_mode == QuicSentPacketManager::TLP_MODE ||
- retransmission_mode == QuicSentPacketManager::RTO_MODE ||
- retransmission_mode == QuicSentPacketManager::PTO_MODE) &&
+ retransmission_mode == QuicSentPacketManager::PTO_MODE &&
!visitor_->WillingAndAbleToWrite()) {
- // Send PING if timer fires in TLP/RTO/PTO mode but there is no data to
- // send.
+ // Send PING if timer fires in PTO mode but there is no data to send.
QUIC_DLOG(INFO) << ENDPOINT
<< "No packet gets sent when timer fires in mode "
<< retransmission_mode << ", send PING";
@@ -4214,13 +4200,9 @@
}
}
if (retransmission_mode == QuicSentPacketManager::PTO_MODE) {
- sent_packet_manager_.AdjustPendingTimerTransmissions();
- }
- if (retransmission_mode != QuicSentPacketManager::LOSS_MODE &&
- retransmission_mode != QuicSentPacketManager::HANDSHAKE_MODE) {
- // When timer fires in TLP/RTO/PTO mode, ensure 1) at least one packet is
- // created, or there is data to send and available credit (such that
- // packets will be sent eventually).
+ // When timer fires in PTO mode, ensure 1) at least one packet is created,
+ // or there is data to send and available credit (such that packets will be
+ // sent eventually).
QUIC_BUG_IF(
quic_bug_12714_27,
packet_creator_.packet_number() == previous_created_packet_number &&
@@ -5974,10 +5956,9 @@
return true;
}
if (bundle_retransmittable_with_pto_ack_ &&
- (sent_packet_manager_.GetConsecutiveRtoCount() > 0 ||
- sent_packet_manager_.GetConsecutivePtoCount() > 0)) {
- // Bundle a retransmittable frame with an ACK if the PTO or RTO has fired
- // in order to recover more quickly in cases of temporary network outage.
+ sent_packet_manager_.GetConsecutivePtoCount() > 0) {
+ // Bundle a retransmittable frame with an ACK if PTO has fired in order to
+ // recover more quickly in cases of temporary network outage.
return true;
}
return false;
@@ -6337,8 +6318,6 @@
}
QUIC_DVLOG(1) << ENDPOINT << error_details;
const bool has_consecutive_pto =
- sent_packet_manager_.GetConsecutiveTlpCount() > 0 ||
- sent_packet_manager_.GetConsecutiveRtoCount() > 0 ||
sent_packet_manager_.GetConsecutivePtoCount() > 0;
if (has_consecutive_pto || visitor_->ShouldKeepConnectionAlive()) {
if (GetQuicReloadableFlag(quic_add_stream_info_to_idle_close_detail) &&
diff --git a/quiche/quic/core/quic_connection.h b/quiche/quic/core/quic_connection.h
index bed54f3..28d5747 100644
--- a/quiche/quic/core/quic_connection.h
+++ b/quiche/quic/core/quic_connection.h
@@ -2103,8 +2103,8 @@
// from the peer. Default to kMaxConsecutiveNonRetransmittablePackets.
size_t max_consecutive_num_packets_with_no_retransmittable_frames_;
- // If true, bundle an ack-eliciting frame with an ACK if the PTO or RTO alarm
- // have previously fired.
+ // If true, bundle an ack-eliciting frame with an ACK if the PTO alarm have
+ // previously fired.
bool bundle_retransmittable_with_pto_ack_;
// If true, the connection will fill up the pipe with extra data whenever the
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc
index b77cc15..4a0db07 100644
--- a/quiche/quic/core/quic_connection_test.cc
+++ b/quiche/quic/core/quic_connection_test.cc
@@ -478,11 +478,6 @@
.IsInitialized();
}
- void SetMaxTailLossProbes(size_t max_tail_loss_probes) {
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(
- QuicConnectionPeer::GetSentPacketManager(this), max_tail_loss_probes);
- }
-
QuicByteCount GetBytesInFlight() {
return QuicConnectionPeer::GetSentPacketManager(this)->GetBytesInFlight();
}
@@ -493,16 +488,6 @@
next_effective_peer_addr_ = std::make_unique<QuicSocketAddress>(addr);
}
- bool PtoEnabled() {
- if (QuicConnectionPeer::GetSentPacketManager(this)->pto_enabled()) {
- // TLP/RTO related tests are stale when PTO is enabled.
- QUICHE_DCHECK(PROTOCOL_TLS1_3 == version().handshake_protocol ||
- GetQuicRestartFlag(quic_default_on_pto2));
- return true;
- }
- return false;
- }
-
void SendOrQueuePacket(SerializedPacket packet) override {
QuicConnection::SendOrQueuePacket(std::move(packet));
self_address_on_default_path_while_sending_packet_ = self_address();
@@ -1692,10 +1677,8 @@
rtt_stats->set_initial_rtt(default_init_rtt * 2);
EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(manager_, 1);
- EXPECT_EQ(1u, manager_->GetConsecutiveRtoCount());
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(manager_, 2);
- EXPECT_EQ(2u, manager_->GetConsecutiveTlpCount());
+ QuicSentPacketManagerPeer::SetConsecutivePtoCount(manager_, 1);
+ EXPECT_EQ(1u, manager_->GetConsecutivePtoCount());
const QuicSocketAddress kNewPeerAddress =
QuicSocketAddress(QuicIpAddress::Loopback6(), /*port=*/23456);
@@ -1722,8 +1705,7 @@
EXPECT_EQ(kNewPeerAddress, connection_.effective_peer_address());
// PORT_CHANGE shouldn't state change in sent packet manager.
EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
- EXPECT_EQ(1u, manager_->GetConsecutiveRtoCount());
- EXPECT_EQ(2u, manager_->GetConsecutiveTlpCount());
+ EXPECT_EQ(1u, manager_->GetConsecutivePtoCount());
EXPECT_EQ(manager_->GetSendAlgorithm(), send_algorithm_);
if (connection_.validate_client_address()) {
EXPECT_EQ(NO_CHANGE, connection_.active_effective_peer_migration_type());
@@ -3321,8 +3303,6 @@
}
TEST_P(QuicConnectionTest, AckNeedsRetransmittableFramesAfterPto) {
- // Disable TLP so the RTO fires immediately.
- connection_.SetMaxTailLossProbes(0);
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
QuicTagVector connection_options;
@@ -3349,8 +3329,7 @@
connection_.GetRetransmissionAlarm()->deadline();
clock_.AdvanceTime(retransmission_time - clock_.Now());
connection_.GetRetransmissionAlarm()->Fire();
- ASSERT_TRUE(manager_->GetConsecutiveRtoCount() > 0 ||
- manager_->GetConsecutivePtoCount() > 0);
+ ASSERT_LT(0u, manager_->GetConsecutivePtoCount());
// Process a packet, which requests a retransmittable frame be bundled
// with the ACK.
@@ -4007,9 +3986,7 @@
EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
}
-TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnRTO) {
- connection_.SetMaxTailLossProbes(0);
-
+TEST_P(QuicConnectionTest, RetransmitForQuicRstStreamNoErrorOnPTO) {
QuicStreamId stream_id = 2;
QuicPacketNumber last_packet;
SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet);
@@ -4019,17 +3996,11 @@
// Fire the RTO and verify that the RST_STREAM is resent, the stream data
// is sent.
- const size_t num_retransmissions = connection_.PtoEnabled() ? 1 : 2;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .Times(AtLeast(num_retransmissions));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1));
clock_.AdvanceTime(DefaultRetransmissionTime());
connection_.GetRetransmissionAlarm()->Fire();
size_t padding_frame_count = writer_->padding_frames().size();
EXPECT_EQ(padding_frame_count + 1u, writer_->frame_count());
- if (num_retransmissions == 2) {
- ASSERT_EQ(1u, writer_->rst_stream_frames().size());
- EXPECT_EQ(stream_id, writer_->rst_stream_frames().front().stream_id);
- }
}
TEST_P(QuicConnectionTest, DoNotSendPendingRetransmissionForResetStream) {
@@ -4167,33 +4138,6 @@
ProcessAckPacket(&frame);
}
-TEST_P(QuicConnectionTest, QueueAfterTwoRTOs) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(0);
-
- for (int i = 0; i < 10; ++i) {
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
- connection_.SendStreamDataWithString(3, "foo", i * 3, NO_FIN);
- }
-
- // Block the writer and ensure they're queued.
- BlockOnNextWrite();
- clock_.AdvanceTime(DefaultRetransmissionTime());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_TRUE(connection_.HasQueuedData());
-
- // Unblock the writer.
- writer_->SetWritable();
- clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(
- 2 * DefaultRetransmissionTime().ToMicroseconds()));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- connection_.GetRetransmissionAlarm()->Fire();
- connection_.OnCanWrite();
-}
-
TEST_P(QuicConnectionTest, WriteBlockedBufferedThenSent) {
BlockOnNextWrite();
writer_->set_is_write_blocked_data_buffered(true);
@@ -4248,9 +4192,7 @@
writer_->SetWritable();
connection_.OnCanWrite();
EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
- uint64_t retransmission = connection_.PtoEnabled() ? 3 : 2;
- EXPECT_FALSE(QuicConnectionPeer::HasRetransmittableFrames(&connection_,
- retransmission));
+ EXPECT_FALSE(QuicConnectionPeer::HasRetransmittableFrames(&connection_, 3));
}
TEST_P(QuicConnectionTest, AlarmsWhenWriteBlocked) {
@@ -4477,85 +4419,6 @@
EXPECT_EQ(QuicPacketNumber(6u), stop_waiting()->least_unacked);
}
-TEST_P(QuicConnectionTest, TLP) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(1);
-
- SendStreamDataToPeer(3, "foo", 0, NO_FIN, nullptr);
- EXPECT_EQ(QuicPacketNumber(1u), stop_waiting()->least_unacked);
- QuicTime retransmission_time =
- connection_.GetRetransmissionAlarm()->deadline();
- EXPECT_NE(QuicTime::Zero(), retransmission_time);
-
- EXPECT_EQ(QuicPacketNumber(1u), writer_->header().packet_number);
- // Simulate the retransmission alarm firing and sending a tlp,
- // so send algorithm's OnRetransmissionTimeout is not called.
- clock_.AdvanceTime(retransmission_time - clock_.Now());
- const QuicPacketNumber retransmission(
- connection_.SupportsMultiplePacketNumberSpaces() ? 3 : 2);
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, retransmission, _, _));
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(retransmission, writer_->header().packet_number);
- // We do not raise the high water mark yet.
- EXPECT_EQ(QuicPacketNumber(1u), stop_waiting()->least_unacked);
-}
-
-TEST_P(QuicConnectionTest, RTO) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(0);
-
- QuicTime default_retransmission_time =
- clock_.ApproximateNow() + DefaultRetransmissionTime();
- SendStreamDataToPeer(3, "foo", 0, NO_FIN, nullptr);
- EXPECT_EQ(QuicPacketNumber(1u), stop_waiting()->least_unacked);
-
- EXPECT_EQ(QuicPacketNumber(1u), writer_->header().packet_number);
- EXPECT_EQ(default_retransmission_time,
- connection_.GetRetransmissionAlarm()->deadline());
- // Simulate the retransmission alarm firing.
- clock_.AdvanceTime(DefaultRetransmissionTime());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(2), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(QuicPacketNumber(2u), writer_->header().packet_number);
- // We do not raise the high water mark yet.
- EXPECT_EQ(QuicPacketNumber(1u), stop_waiting()->least_unacked);
-}
-
-// Regression test of b/133771183.
-TEST_P(QuicConnectionTest, RtoWithNoDataToRetransmit) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- connection_.SetMaxTailLossProbes(0);
-
- SendStreamDataToPeer(3, "foo", 0, NO_FIN, nullptr);
- // Connection is cwnd limited.
- CongestionBlockWrites();
- // Stream gets reset.
- SendRstStream(3, QUIC_ERROR_PROCESSING_STREAM, 3);
- // Simulate the retransmission alarm firing.
- clock_.AdvanceTime(DefaultRetransmissionTime());
- // RTO fires, but there is no packet to be RTOed.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(1u, writer_->rst_stream_frames().size());
-
- EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(40);
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(20);
- EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(false));
- EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(1);
- // Receives packets 1 - 40.
- for (size_t i = 1; i <= 40; ++i) {
- ProcessDataPacket(i);
- }
-}
-
TEST_P(QuicConnectionTest, SendHandshakeMessages) {
use_tagging_decrypter();
// A TaggingEncrypter puts kTagSize copies of the given byte (0x01 here) at
@@ -4667,41 +4530,6 @@
ProcessDataPacketAtLevel(3, !kHasStopWaiting, ENCRYPTION_ZERO_RTT);
}
-TEST_P(QuicConnectionTest, TestRetransmitOrder) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(0);
-
- QuicByteCount first_packet_size;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(SaveArg<3>(&first_packet_size));
-
- connection_.SendStreamDataWithString(3, "first_packet", 0, NO_FIN);
- QuicByteCount second_packet_size;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(SaveArg<3>(&second_packet_size));
- connection_.SendStreamDataWithString(3, "second_packet", 12, NO_FIN);
- EXPECT_NE(first_packet_size, second_packet_size);
- // Advance the clock by huge time to make sure packets will be retransmitted.
- clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10));
- {
- InSequence s;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, first_packet_size, _));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, second_packet_size, _));
- }
- connection_.GetRetransmissionAlarm()->Fire();
-
- // Advance again and expect the packets to be sent again in the same order.
- clock_.AdvanceTime(QuicTime::Delta::FromSeconds(20));
- {
- InSequence s;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, first_packet_size, _));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, second_packet_size, _));
- }
- connection_.GetRetransmissionAlarm()->Fire();
-}
-
TEST_P(QuicConnectionTest, Buffer100NonDecryptablePacketsThenKeyChange) {
if (connection_.SupportsMultiplePacketNumberSpaces()) {
return;
@@ -4756,55 +4584,7 @@
EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
}
-TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(0);
-
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- connection_.SendStreamDataWithString(2, "foo", 0, NO_FIN);
- connection_.SendStreamDataWithString(3, "bar", 0, NO_FIN);
- QuicAlarm* retransmission_alarm = connection_.GetRetransmissionAlarm();
- EXPECT_TRUE(retransmission_alarm->IsSet());
- EXPECT_EQ(DefaultRetransmissionTime(),
- retransmission_alarm->deadline() - clock_.Now());
-
- // Advance the time right before the RTO, then receive an ack for the first
- // packet to delay the RTO.
- clock_.AdvanceTime(DefaultRetransmissionTime());
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
- QuicAckFrame ack = InitAckFrame(1);
- ProcessAckPacket(&ack);
- // Now we have an RTT sample of DefaultRetransmissionTime(500ms),
- // so the RTO has increased to 2 * SRTT.
- EXPECT_TRUE(retransmission_alarm->IsSet());
- EXPECT_EQ(retransmission_alarm->deadline() - clock_.Now(),
- 2 * DefaultRetransmissionTime());
-
- // Move forward past the original RTO and ensure the RTO is still pending.
- clock_.AdvanceTime(2 * DefaultRetransmissionTime());
-
- // Ensure the second packet gets retransmitted when it finally fires.
- EXPECT_TRUE(retransmission_alarm->IsSet());
- EXPECT_EQ(retransmission_alarm->deadline(), clock_.ApproximateNow());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- // Manually cancel the alarm to simulate a real test.
- connection_.GetRetransmissionAlarm()->Fire();
-
- // The new retransmitted packet number should set the RTO to a larger value
- // than previously.
- EXPECT_TRUE(retransmission_alarm->IsSet());
- QuicTime next_rto_time = retransmission_alarm->deadline();
- QuicTime expected_rto_time =
- connection_.sent_packet_manager().GetRetransmissionTime();
- EXPECT_EQ(next_rto_time, expected_rto_time);
-}
-
TEST_P(QuicConnectionTest, TestQueued) {
- connection_.SetMaxTailLossProbes(0);
-
EXPECT_EQ(0u, connection_.NumQueuedPackets());
BlockOnNextWrite();
connection_.SendStreamDataWithString(1, "foo", 0, NO_FIN);
@@ -5757,84 +5537,6 @@
TestConnectionCloseQuicErrorCode(QUIC_NETWORK_IDLE_TIMEOUT);
}
-TEST_P(QuicConnectionTest, TimeoutAfterRetransmission) {
- if (connection_.PtoEnabled()) {
- return;
- }
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- EXPECT_TRUE(connection_.connected());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- QuicConfig config;
- connection_.SetFromConfig(config);
-
- const QuicTime start_time = clock_.Now();
- const QuicTime::Delta initial_idle_timeout =
- QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs - 1);
- QuicTime default_timeout = clock_.Now() + initial_idle_timeout;
-
- connection_.SetMaxTailLossProbes(0);
- const QuicTime default_retransmission_time =
- start_time + DefaultRetransmissionTime();
-
- ASSERT_LT(default_retransmission_time, default_timeout);
-
- // When we send a packet, the timeout will change to 5 ms +
- // kInitialIdleTimeoutSecs (but it will not reschedule the alarm).
- const QuicTime::Delta five_ms = QuicTime::Delta::FromMilliseconds(5);
- const QuicTime send_time = start_time + five_ms;
- clock_.AdvanceTime(five_ms);
- ASSERT_EQ(send_time, clock_.Now());
- SendStreamDataToPeer(
- GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo",
- 0, FIN, nullptr);
- EXPECT_EQ(default_timeout + five_ms,
- connection_.GetTimeoutAlarm()->deadline());
-
- // Move forward 5 ms and receive a packet, which will move the timeout
- // forward 5 ms more (but will not reschedule the alarm).
- const QuicTime receive_time = send_time + five_ms;
- clock_.AdvanceTime(receive_time - clock_.Now());
- ASSERT_EQ(receive_time, clock_.Now());
- ProcessPacket(1);
-
- // Now move forward to the retransmission time and retransmit the
- // packet, which should move the timeout forward again (but will not
- // reschedule the alarm).
- EXPECT_EQ(default_retransmission_time + five_ms,
- connection_.GetRetransmissionAlarm()->deadline());
- // Simulate the retransmission alarm firing.
- const QuicTime rto_time = send_time + DefaultRetransmissionTime();
- const QuicTime final_timeout = rto_time + initial_idle_timeout;
- clock_.AdvanceTime(rto_time - clock_.Now());
- ASSERT_EQ(rto_time, clock_.Now());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(2u), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
-
- // Advance to the original timeout and fire the alarm. The connection should
- // timeout, and the alarm should be registered based on the time of the
- // retransmission.
- clock_.AdvanceTime(default_timeout - clock_.Now());
- ASSERT_EQ(default_timeout.ToDebuggingValue(),
- clock_.Now().ToDebuggingValue());
- EXPECT_EQ(default_timeout, clock_.Now());
- EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet());
- EXPECT_TRUE(connection_.connected());
- ASSERT_EQ(final_timeout.ToDebuggingValue(),
- connection_.GetTimeoutAlarm()->deadline().ToDebuggingValue());
-
- // This time, we should time out.
- EXPECT_CALL(visitor_,
- OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1));
- clock_.AdvanceTime(final_timeout - clock_.Now());
- EXPECT_EQ(connection_.GetTimeoutAlarm()->deadline(), clock_.Now());
- EXPECT_EQ(final_timeout, clock_.Now());
- connection_.GetTimeoutAlarm()->Fire();
- EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
- EXPECT_FALSE(connection_.connected());
- TestConnectionCloseQuicErrorCode(QUIC_NETWORK_IDLE_TIMEOUT);
-}
-
TEST_P(QuicConnectionTest, TimeoutAfterSendAfterHandshake) {
// When the idle timeout fires, verify that by default we do not send any
// connection close packets.
@@ -5915,65 +5617,6 @@
IsError(QUIC_NETWORK_IDLE_TIMEOUT));
}
-TEST_P(QuicConnectionTest, TimeoutAfterSendSilentCloseAndTLP) {
- if (connection_.PtoEnabled()) {
- return;
- }
- // Same test as above, but sending TLPs causes a connection close to be sent.
- EXPECT_TRUE(connection_.connected());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- QuicConfig config;
-
- // Create a handshake message that also enables silent close.
- CryptoHandshakeMessage msg;
- std::string error_details;
- QuicConfig client_config;
- client_config.SetInitialStreamFlowControlWindowToSend(
- kInitialStreamFlowControlWindowForTest);
- client_config.SetInitialSessionFlowControlWindowToSend(
- kInitialSessionFlowControlWindowForTest);
- client_config.SetIdleNetworkTimeout(
- QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs));
- client_config.ToHandshakeMessage(&msg, connection_.transport_version());
- const QuicErrorCode error =
- config.ProcessPeerHello(msg, CLIENT, &error_details);
- EXPECT_THAT(error, IsQuicNoError());
-
- connection_.SetFromConfig(config);
- QuicConnectionPeer::DisableBandwidthUpdate(&connection_);
-
- const QuicTime::Delta default_idle_timeout =
- QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs - 1);
- const QuicTime::Delta five_ms = QuicTime::Delta::FromMilliseconds(5);
- QuicTime default_timeout = clock_.ApproximateNow() + default_idle_timeout;
-
- // When we send a packet, the timeout will change to 5ms +
- // kInitialIdleTimeoutSecs.
- clock_.AdvanceTime(five_ms);
- SendStreamDataToPeer(
- GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo",
- 0, FIN, nullptr);
- EXPECT_EQ(default_timeout + five_ms,
- connection_.GetTimeoutAlarm()->deadline());
-
- // Retransmit the packet via tail loss probe.
- clock_.AdvanceTime(connection_.GetRetransmissionAlarm()->deadline() -
- clock_.Now());
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(2u), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
-
- // This time, we should time out and send a connection close due to the TLP.
- EXPECT_CALL(visitor_,
- OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1));
- clock_.AdvanceTime(connection_.GetTimeoutAlarm()->deadline() -
- clock_.ApproximateNow() + five_ms);
- connection_.GetTimeoutAlarm()->Fire();
- EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
- EXPECT_FALSE(connection_.connected());
- TestConnectionCloseQuicErrorCode(QUIC_NETWORK_IDLE_TIMEOUT);
-}
-
TEST_P(QuicConnectionTest, TimeoutAfterSendSilentCloseWithOpenStreams) {
// Same test as above, but having open streams causes a connection close
// to be sent.
@@ -6149,58 +5792,6 @@
TestConnectionCloseQuicErrorCode(QUIC_NETWORK_IDLE_TIMEOUT);
}
-TEST_P(QuicConnectionTest, TimeoutAfter5ClientRTOs) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(2);
- EXPECT_TRUE(connection_.connected());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- QuicConfig config;
- QuicTagVector connection_options;
- connection_options.push_back(k5RTO);
- config.SetConnectionOptionsToSend(connection_options);
- QuicConfigPeer::SetNegotiated(&config, true);
- if (GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2)) {
- EXPECT_CALL(visitor_, GetHandshakeState())
- .WillRepeatedly(Return(HANDSHAKE_COMPLETE));
- }
- if (connection_.version().UsesTls()) {
- QuicConfigPeer::SetReceivedOriginalConnectionId(
- &config, connection_.connection_id());
- QuicConfigPeer::SetReceivedInitialSourceConnectionId(
- &config, connection_.connection_id());
- }
- connection_.SetFromConfig(config);
-
- // Send stream data.
- SendStreamDataToPeer(
- GetNthClientInitiatedStreamId(1, connection_.transport_version()), "foo",
- 0, FIN, nullptr);
-
- // Fire the retransmission alarm 6 times, twice for TLP and 4 times for RTO.
- for (int i = 0; i < 6; ++i) {
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet());
- EXPECT_TRUE(connection_.connected());
- }
- EXPECT_CALL(visitor_, OnPathDegrading());
- connection_.PathDegradingTimeout();
-
- EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
- EXPECT_EQ(4u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
- // This time, we should time out.
- EXPECT_CALL(visitor_,
- OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AtLeast(1));
- ASSERT_TRUE(connection_.BlackholeDetectionInProgress());
- connection_.GetBlackholeDetectorAlarm()->Fire();
- EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
- EXPECT_FALSE(connection_.connected());
- TestConnectionCloseQuicErrorCode(QUIC_TOO_MANY_RTOS);
-}
-
TEST_P(QuicConnectionTest, SendScheduler) {
// Test that if we send a packet without delay, it is not queued.
QuicFramerPeer::SetPerspective(&peer_framer_, Perspective::IS_CLIENT);
@@ -7102,63 +6693,6 @@
IsError(QUIC_INVALID_VERSION_NEGOTIATION_PACKET));
}
-TEST_P(QuicConnectionTest, CheckSendStats) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(0);
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- connection_.SendStreamDataWithString(3, "first", 0, NO_FIN);
- size_t first_packet_size = writer_->last_packet_size();
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- connection_.SendStreamDataWithString(5, "second", 0, NO_FIN);
- size_t second_packet_size = writer_->last_packet_size();
-
- // 2 retransmissions due to rto, 1 due to explicit nack.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(3);
-
- // Retransmit due to RTO.
- clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10));
- connection_.GetRetransmissionAlarm()->Fire();
-
- // Retransmit due to explicit nacks.
- QuicAckFrame nack_three =
- InitAckFrame({{QuicPacketNumber(2), QuicPacketNumber(3)},
- {QuicPacketNumber(4), QuicPacketNumber(5)}});
-
- LostPacketVector lost_packets;
- lost_packets.push_back(
- LostPacket(QuicPacketNumber(1), kMaxOutgoingPacketSize));
- lost_packets.push_back(
- LostPacket(QuicPacketNumber(3), kMaxOutgoingPacketSize));
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _, _))
- .WillOnce(DoAll(SetArgPointee<5>(lost_packets),
- Return(LossDetectionInterface::DetectionStats())));
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- ProcessAckPacket(&nack_three);
-
- EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
- .WillOnce(Return(QuicBandwidth::Zero()));
-
- const QuicConnectionStats& stats = connection_.GetStats();
- // For IETF QUIC, version is not included as the encryption level switches to
- // FORWARD_SECURE in SendStreamDataWithString.
- size_t save_on_version =
- GetParam().version.HasIetfInvariantHeader() ? 0 : kQuicVersionSize;
- EXPECT_EQ(3 * first_packet_size + 2 * second_packet_size - save_on_version,
- stats.bytes_sent);
- EXPECT_EQ(5u, stats.packets_sent);
- EXPECT_EQ(2 * first_packet_size + second_packet_size - save_on_version,
- stats.bytes_retransmitted);
- EXPECT_EQ(3u, stats.packets_retransmitted);
- EXPECT_EQ(1u, stats.rto_count);
- EXPECT_EQ(kDefaultMaxPacketSize, stats.egress_mtu);
-}
-
TEST_P(QuicConnectionTest, ProcessFramesIfPacketClosedConnection) {
// Construct a packet with stream frame and connection close frame.
QuicPacketHeader header;
@@ -9201,10 +8735,8 @@
rtt_stats->set_initial_rtt(default_init_rtt * 2);
EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(manager_, 1);
- EXPECT_EQ(1u, manager_->GetConsecutiveRtoCount());
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(manager_, 2);
- EXPECT_EQ(2u, manager_->GetConsecutiveTlpCount());
+ QuicSentPacketManagerPeer::SetConsecutivePtoCount(manager_, 1);
+ EXPECT_EQ(1u, manager_->GetConsecutivePtoCount());
const SendAlgorithmInterface* send_algorithm = manager_->GetSendAlgorithm();
// Migrate to a new address with different IP.
@@ -9214,8 +8746,7 @@
connection_.MigratePath(kNewSelfAddress, connection_.peer_address(),
&new_writer, false);
EXPECT_EQ(default_init_rtt, manager_->GetRttStats()->initial_rtt());
- EXPECT_EQ(0u, manager_->GetConsecutiveRtoCount());
- EXPECT_EQ(0u, manager_->GetConsecutiveTlpCount());
+ EXPECT_EQ(0u, manager_->GetConsecutivePtoCount());
EXPECT_NE(send_algorithm, manager_->GetSendAlgorithm());
}
@@ -9818,9 +9349,8 @@
}
// Regresstion test for b/138962304.
-TEST_P(QuicConnectionTest, TlpAndWriteBlocked) {
+TEST_P(QuicConnectionTest, PtoAndWriteBlocked) {
EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
- connection_.SetMaxTailLossProbes(1);
QuicStreamId stream_id = 2;
QuicPacketNumber last_data_packet;
@@ -9843,44 +9373,6 @@
EXPECT_EQ(1u, connection_.NumQueuedPackets());
}
-// Regresstion test for b/139375344.
-TEST_P(QuicConnectionTest, RtoForcesSendingPing) {
- if (connection_.PtoEnabled()) {
- return;
- }
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- connection_.SetMaxTailLossProbes(2);
- EXPECT_EQ(0u, connection_.GetStats().tlp_count);
- EXPECT_EQ(0u, connection_.GetStats().rto_count);
-
- SendStreamDataToPeer(2, "foo", 0, NO_FIN, nullptr);
- QuicTime retransmission_time =
- connection_.GetRetransmissionAlarm()->deadline();
- EXPECT_NE(QuicTime::Zero(), retransmission_time);
- // TLP fires.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(2), _, _));
- clock_.AdvanceTime(retransmission_time - clock_.Now());
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(1u, connection_.GetStats().tlp_count);
- EXPECT_EQ(0u, connection_.GetStats().rto_count);
- EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
-
- // Packet 1 gets acked.
- QuicAckFrame frame = InitAckFrame(1);
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(_, _, _, _, _));
- ProcessAckPacket(1, &frame);
- EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
- retransmission_time = connection_.GetRetransmissionAlarm()->deadline();
-
- // RTO fires, verify a PING packet gets sent because there is no data to send.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(3), _, _));
- clock_.AdvanceTime(retransmission_time - clock_.Now());
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(1u, connection_.GetStats().tlp_count);
- EXPECT_EQ(1u, connection_.GetStats().rto_count);
- EXPECT_EQ(1u, writer_->ping_frames().size());
-}
-
TEST_P(QuicConnectionTest, ProbeTimeout) {
QuicConfig config;
QuicTagVector connection_options;
@@ -9945,8 +9437,6 @@
EXPECT_CALL(visitor_, OnPathDegrading());
connection_.PathDegradingTimeout();
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
EXPECT_EQ(5u, connection_.sent_packet_manager().GetConsecutivePtoCount());
// Closes connection on 6th PTO.
// May send multiple connecction close packets with multiple PN spaces.
@@ -9997,8 +9487,6 @@
EXPECT_CALL(visitor_, OnPathDegrading());
connection_.PathDegradingTimeout();
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
EXPECT_EQ(6u, connection_.sent_packet_manager().GetConsecutivePtoCount());
// Closes connection on 7th PTO.
EXPECT_CALL(visitor_,
@@ -10048,8 +9536,6 @@
EXPECT_CALL(visitor_, OnPathDegrading());
connection_.PathDegradingTimeout();
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
- EXPECT_EQ(0u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
EXPECT_EQ(7u, connection_.sent_packet_manager().GetConsecutivePtoCount());
// Closes connection on 8th PTO.
EXPECT_CALL(visitor_,
@@ -10353,49 +9839,6 @@
connection_close_frames[0].transport_close_frame_type);
}
-// Regression test for b/137401387 and b/138962304.
-TEST_P(QuicConnectionTest, RtoPacketAsTwo) {
- if (connection_.PtoEnabled()) {
- return;
- }
- connection_.SetMaxTailLossProbes(1);
- connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
- std::string stream_data(3000, 's');
- // Send packets 1 - 66 and exhaust cwnd.
- for (size_t i = 0; i < 22; ++i) {
- // 3 packets for each stream, the first 2 are guaranteed to be full packets.
- SendStreamDataToPeer(i + 2, stream_data, 0, FIN, nullptr);
- }
- CongestionBlockWrites();
-
- // Fires TLP. Please note, this tail loss probe has 1 byte less stream data
- // compared to packet 1 because packet number length increases.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(67), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
- // Fires RTO. Please note, although packets 2 and 3 *should* be RTOed, but
- // packet 2 gets RTOed to two packets because packet number length increases.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(68), _, _));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(69), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
-
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- // Resets all streams except 2 and ack packets 1 and 2. Now, packet 3 is the
- // only one containing retransmittable frames.
- for (size_t i = 1; i < 22; ++i) {
- notifier_.OnStreamReset(i + 2, QUIC_STREAM_CANCELLED);
- }
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(_, _, _, _, _));
- QuicAckFrame frame =
- InitAckFrame({{QuicPacketNumber(1), QuicPacketNumber(3)}});
- ProcessAckPacket(1, &frame);
- CongestionUnblockWrites();
-
- // Fires TLP, verify a PING gets sent because packet 3 is marked
- // RTO_RETRANSMITTED.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(70), _, _));
- connection_.GetRetransmissionAlarm()->Fire();
-}
-
TEST_P(QuicConnectionTest, PtoSkipsPacketNumber) {
QuicConfig config;
QuicTagVector connection_options;
diff --git a/quiche/quic/core/quic_constants.h b/quiche/quic/core/quic_constants.h
index 189179f..3fc4c8b 100644
--- a/quiche/quic/core/quic_constants.h
+++ b/quiche/quic/core/quic_constants.h
@@ -181,6 +181,13 @@
// create available streams entries.
const int kMaxPromisedStreamsMultiplier = kMaxAvailableStreamsMultiplier - 1;
+// The 1st PTO is armed with max of earliest in flight sent time + PTO
+// delay and kFirstPtoSrttMultiplier * srtt from last in flight packet.
+const float kFirstPtoSrttMultiplier = 1.5;
+
+// The multiplier of RTT variation when calculating PTO timeout.
+const int kPtoRttvarMultiplier = 2;
+
// TCP RFC calls for 1 second RTO however Linux differs from this default and
// define the minimum RTO to 200ms, we will use the same until we have data to
// support a higher or lower value.
diff --git a/quiche/quic/core/quic_control_frame_manager.cc b/quiche/quic/core/quic_control_frame_manager.cc
index 64e5eec..df7b263 100644
--- a/quiche/quic/core/quic_control_frame_manager.cc
+++ b/quiche/quic/core/quic_control_frame_manager.cc
@@ -266,8 +266,7 @@
bool QuicControlFrameManager::RetransmitControlFrame(const QuicFrame& frame,
TransmissionType type) {
- QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
- type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
+ QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == PROBING_RETRANSMISSION);
QuicControlFrameId id = GetControlFrameId(frame);
if (id == kInvalidControlFrameId) {
// Frame does not have a valid control frame ID, ignore it. Returns true
diff --git a/quiche/quic/core/quic_flags_list.h b/quiche/quic/core/quic_flags_list.h
index 083ec08..b7a888b 100644
--- a/quiche/quic/core/quic_flags_list.h
+++ b/quiche/quic/core/quic_flags_list.h
@@ -37,8 +37,6 @@
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_fix_on_stream_reset, true)
// If true, consolidate more logic into SetRetransmissionAlarm to ensure the logic is applied consistently.
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_simplify_set_retransmission_alarm, true)
-// If true, default on PTO which unifies TLP + RTO loss recovery.
-QUIC_FLAG(FLAGS_quic_restart_flag_quic_default_on_pto2, true)
// If true, default-enable 5RTO blachole detection.
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_default_enable_5rto_blackhole_detection2, true)
// If true, deliver INITIAL packets before other types of packets in QuicBufferedPacketStore.
diff --git a/quiche/quic/core/quic_packet_creator_test.cc b/quiche/quic/core/quic_packet_creator_test.cc
index b223326..02757bd 100644
--- a/quiche/quic/core/quic_packet_creator_test.cc
+++ b/quiche/quic/core/quic_packet_creator_test.cc
@@ -1932,16 +1932,16 @@
EXPECT_TRUE(creator_.AddFrame(ack_frame, LOSS_RETRANSMISSION));
ASSERT_EQ(serialized_packet_, nullptr);
- EXPECT_TRUE(creator_.AddFrame(stream_frame, RTO_RETRANSMISSION));
+ EXPECT_TRUE(creator_.AddFrame(stream_frame, PTO_RETRANSMISSION));
ASSERT_EQ(serialized_packet_, nullptr);
- EXPECT_TRUE(creator_.AddFrame(padding_frame, TLP_RETRANSMISSION));
+ EXPECT_TRUE(creator_.AddFrame(padding_frame, PROBING_RETRANSMISSION));
creator_.FlushCurrentPacket();
ASSERT_TRUE(serialized_packet_->encrypted_buffer);
// The last retransmittable frame on packet is a stream frame, the packet's
// transmission type should be the same as the stream frame's.
- EXPECT_EQ(serialized_packet_->transmission_type, RTO_RETRANSMISSION);
+ EXPECT_EQ(serialized_packet_->transmission_type, PTO_RETRANSMISSION);
DeleteSerializedPacket();
}
diff --git a/quiche/quic/core/quic_sent_packet_manager.cc b/quiche/quic/core/quic_sent_packet_manager.cc
index 47e7863..41e6ea7 100644
--- a/quiche/quic/core/quic_sent_packet_manager.cc
+++ b/quiche/quic/core/quic_sent_packet_manager.cc
@@ -30,13 +30,6 @@
namespace {
static const int64_t kDefaultRetransmissionTimeMs = 500;
-static const int64_t kMaxRetransmissionTimeMs = 60000;
-// Maximum number of exponential backoffs used for RTO timeouts.
-static const size_t kMaxRetransmissions = 10;
-// Maximum number of packets retransmitted upon an RTO.
-static const size_t kMaxRetransmissionsOnTimeout = 2;
-// The path degrading delay is the sum of this number of consecutive RTO delays.
-const size_t kNumRetransmissionDelaysForPathDegradingDelay = 2;
// Ensure the handshake timer isnt't faster than 10ms.
// This limits the tenth retransmitted packet to 10s after the initial CHLO.
@@ -46,13 +39,15 @@
// per draft RFC draft-dukkipati-tcpm-tcp-loss-probe.
static const size_t kDefaultMaxTailLossProbes = 2;
+// The multiplier for calculating PTO timeout before any RTT sample is
+// available.
+static const float kPtoMultiplierWithoutRttSamples = 3;
+
// Returns true of retransmissions of the specified type should retransmit
// the frames directly (as opposed to resulting in a loss notification).
inline bool ShouldForceRetransmission(TransmissionType transmission_type) {
return transmission_type == HANDSHAKE_RETRANSMISSION ||
- transmission_type == TLP_RETRANSMISSION ||
transmission_type == PROBING_RETRANSMISSION ||
- transmission_type == RTO_RETRANSMISSION ||
transmission_type == PTO_RETRANSMISSION;
}
@@ -81,56 +76,25 @@
network_change_visitor_(nullptr),
initial_congestion_window_(kInitialCongestionWindow),
loss_algorithm_(&uber_loss_algorithm_),
- consecutive_rto_count_(0),
- consecutive_tlp_count_(0),
consecutive_crypto_retransmission_count_(0),
pending_timer_transmission_count_(0),
- max_tail_loss_probes_(kDefaultMaxTailLossProbes),
- max_rto_packets_(kMaxRetransmissionsOnTimeout),
using_pacing_(false),
- use_new_rto_(false),
conservative_handshake_retransmits_(false),
- min_tlp_timeout_(
- QuicTime::Delta::FromMilliseconds(kMinTailLossProbeTimeoutMs)),
- min_rto_timeout_(
- QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs)),
largest_mtu_acked_(0),
handshake_finished_(false),
peer_max_ack_delay_(
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs)),
rtt_updated_(false),
acked_packets_iter_(last_ack_frame_.packets.rbegin()),
- pto_enabled_(GetQuicRestartFlag(quic_default_on_pto2)),
- max_probe_packets_per_pto_(2),
consecutive_pto_count_(0),
handshake_mode_disabled_(false),
- skip_packet_number_for_pto_(false),
- always_include_max_ack_delay_for_pto_timeout_(true),
- pto_exponential_backoff_start_point_(0),
- pto_rttvar_multiplier_(4),
- num_tlp_timeout_ptos_(0),
handshake_packet_acked_(false),
zero_rtt_packet_acked_(false),
one_rtt_packet_acked_(false),
- first_pto_srtt_multiplier_(0),
- use_standard_deviation_for_pto_(false),
- pto_multiplier_without_rtt_samples_(3),
num_ptos_for_path_degrading_(kNumProbeTimeoutsForPathDegradingDelay),
ignore_pings_(false),
ignore_ack_delay_(false) {
SetSendAlgorithm(congestion_control_type);
- if (pto_enabled_) {
- QUIC_RESTART_FLAG_COUNT_N(quic_default_on_pto2, 1, 2);
- // TODO(fayang): change the default values when deprecating
- // quic_default_on_pto2.
- // Default to 1 packet per PTO and skip a packet number. Arm the 1st PTO
- // with max of earliest in flight sent time + PTO delay and 1.5 * srtt from
- // last in flight packet.
- max_probe_packets_per_pto_ = 1;
- skip_packet_number_for_pto_ = true;
- first_pto_srtt_multiplier_ = 1.5;
- pto_rttvar_multiplier_ = 2;
- }
}
QuicSentPacketManager::~QuicSentPacketManager() {}
@@ -167,82 +131,18 @@
if (config.HasClientSentConnectionOption(kMAD0, perspective)) {
ignore_ack_delay_ = true;
}
- if (config.HasClientSentConnectionOption(kMAD2, perspective)) {
- // Set the minimum to the alarm granularity.
- min_tlp_timeout_ = kAlarmGranularity;
- }
- if (config.HasClientSentConnectionOption(kMAD3, perspective)) {
- // Set the minimum to the alarm granularity.
- min_rto_timeout_ = kAlarmGranularity;
- }
- if (!GetQuicRestartFlag(quic_default_on_pto2)) {
- if (config.HasClientSentConnectionOption(k2PTO, perspective)) {
- pto_enabled_ = true;
- }
- if (config.HasClientSentConnectionOption(k1PTO, perspective)) {
- pto_enabled_ = true;
- max_probe_packets_per_pto_ = 1;
- }
-
- if (config.HasClientSentConnectionOption(kPTOS, perspective)) {
- if (!pto_enabled_) {
- QUIC_PEER_BUG(quic_peer_bug_12552_1)
- << "PTO is not enabled when receiving PTOS connection option.";
- pto_enabled_ = true;
- max_probe_packets_per_pto_ = 1;
- }
- skip_packet_number_for_pto_ = true;
- }
- if (pto_enabled_) {
- if (config.HasClientSentConnectionOption(kPTOA, perspective)) {
- always_include_max_ack_delay_for_pto_timeout_ = false;
- }
- if (config.HasClientSentConnectionOption(kPEB1, perspective)) {
- StartExponentialBackoffAfterNthPto(1);
- }
- if (config.HasClientSentConnectionOption(kPEB2, perspective)) {
- StartExponentialBackoffAfterNthPto(2);
- }
- if (config.HasClientSentConnectionOption(kPVS1, perspective)) {
- pto_rttvar_multiplier_ = 2;
- }
- if (config.HasClientSentConnectionOption(kPAG1, perspective)) {
- QUIC_CODE_COUNT(one_aggressive_pto);
- num_tlp_timeout_ptos_ = 1;
- }
- if (config.HasClientSentConnectionOption(kPAG2, perspective)) {
- QUIC_CODE_COUNT(two_aggressive_ptos);
- num_tlp_timeout_ptos_ = 2;
- }
- if (config.HasClientSentConnectionOption(kPLE1, perspective)) {
- first_pto_srtt_multiplier_ = 0.5;
- } else if (config.HasClientSentConnectionOption(kPLE2, perspective)) {
- first_pto_srtt_multiplier_ = 1.5;
- }
- if (config.HasClientSentConnectionOption(kAPTO, perspective)) {
- pto_multiplier_without_rtt_samples_ = 1.5;
- }
- if (config.HasClientSentConnectionOption(kPSDA, perspective)) {
- use_standard_deviation_for_pto_ = true;
- rtt_stats_.EnableStandardDeviationCalculation();
- }
- }
+ if (config.HasClientRequestedIndependentOption(kPDP1, perspective)) {
+ num_ptos_for_path_degrading_ = 1;
}
-
- if (pto_enabled_) {
- if (config.HasClientRequestedIndependentOption(kPDP1, perspective)) {
- num_ptos_for_path_degrading_ = 1;
- }
- if (config.HasClientRequestedIndependentOption(kPDP2, perspective)) {
- num_ptos_for_path_degrading_ = 2;
- }
- if (config.HasClientRequestedIndependentOption(kPDP3, perspective)) {
- num_ptos_for_path_degrading_ = 3;
- }
- if (config.HasClientRequestedIndependentOption(kPDP5, perspective)) {
- num_ptos_for_path_degrading_ = 5;
- }
+ if (config.HasClientRequestedIndependentOption(kPDP2, perspective)) {
+ num_ptos_for_path_degrading_ = 2;
+ }
+ if (config.HasClientRequestedIndependentOption(kPDP3, perspective)) {
+ num_ptos_for_path_degrading_ = 3;
+ }
+ if (config.HasClientRequestedIndependentOption(kPDP5, perspective)) {
+ num_ptos_for_path_degrading_ = 5;
}
// Configure congestion control.
@@ -296,19 +196,6 @@
}
using_pacing_ = !GetQuicFlag(FLAGS_quic_disable_pacing_for_perf_tests);
-
- if (config.HasClientSentConnectionOption(kNTLP, perspective)) {
- max_tail_loss_probes_ = 0;
- }
- if (config.HasClientSentConnectionOption(k1TLP, perspective)) {
- max_tail_loss_probes_ = 1;
- }
- if (config.HasClientSentConnectionOption(k1RTO, perspective)) {
- max_rto_packets_ = 1;
- }
- if (config.HasClientSentConnectionOption(kNRTO, perspective)) {
- use_new_rto_ = true;
- }
// Configure loss detection.
if (config.HasClientRequestedIndependentOption(kILD0, perspective)) {
uber_loss_algorithm_.SetReorderingShift(kDefaultIetfLossDelayShift);
@@ -458,10 +345,6 @@
unacked_packets_.NotifyAggregatedStreamFrameAcked(
last_ack_frame_.ack_delay_time);
InvokeLossDetection(ack_receive_time);
- // Ignore losses in RTO mode.
- if (consecutive_rto_count_ > 0 && !use_new_rto_) {
- packets_lost_.clear();
- }
MaybeInvokeCongestionEvent(rtt_updated, prior_bytes_in_flight,
ack_receive_time);
unacked_packets_.RemoveObsoletePackets();
@@ -474,33 +357,13 @@
// Anytime we are making forward progress and have a new RTT estimate, reset
// the backoff counters.
if (rtt_updated) {
- if (consecutive_rto_count_ > 0) {
- // If the ack acknowledges data sent prior to the RTO,
- // the RTO was spurious.
- if (LargestAcked(ack_frame) < first_rto_transmission_) {
- // Replace SRTT with latest_rtt and increase the variance to prevent
- // a spurious RTO from happening again.
- rtt_stats_.ExpireSmoothedMetrics();
- } else {
- if (!use_new_rto_) {
- send_algorithm_->OnRetransmissionTimeout(true);
- }
- }
- }
- // Records the max consecutive RTO or PTO before forward progress has been
- // made.
- if (consecutive_rto_count_ >
+ // Records the max consecutive PTO before forward progress has been made.
+ if (consecutive_pto_count_ >
stats_->max_consecutive_rto_with_forward_progress) {
stats_->max_consecutive_rto_with_forward_progress =
- consecutive_rto_count_;
- } else if (consecutive_pto_count_ >
- stats_->max_consecutive_rto_with_forward_progress) {
- stats_->max_consecutive_rto_with_forward_progress =
consecutive_pto_count_;
}
// Reset all retransmit counters any time a new packet is acked.
- consecutive_rto_count_ = 0;
- consecutive_tlp_count_ = 0;
consecutive_pto_count_ = 0;
consecutive_crypto_retransmission_count_ = 0;
}
@@ -607,39 +470,9 @@
bool QuicSentPacketManager::ShouldAddMaxAckDelay(
PacketNumberSpace space) const {
- QUICHE_DCHECK(pto_enabled_);
- if (supports_multiple_packet_number_spaces() && space != APPLICATION_DATA) {
- // When the PTO is armed for Initial or Handshake packet number spaces,
- // the max_ack_delay is 0.
- return false;
- }
- if (always_include_max_ack_delay_for_pto_timeout_) {
- return true;
- }
- if (!unacked_packets_
- .GetLargestSentRetransmittableOfPacketNumberSpace(APPLICATION_DATA)
- .IsInitialized() ||
- unacked_packets_.GetLargestSentRetransmittableOfPacketNumberSpace(
- APPLICATION_DATA) <
- FirstSendingPacketNumber() + kMinReceivedBeforeAckDecimation - 1) {
- // Peer is doing TCP style acking. Expect an immediate ACK if more than 1
- // packet are outstanding.
- if (unacked_packets_.packets_in_flight() >=
- kDefaultRetransmittablePacketsBeforeAck) {
- return false;
- }
- } else if (unacked_packets_.packets_in_flight() >=
- kMaxRetransmittablePacketsBeforeAck) {
- // Peer is doing ack decimation. Expect an immediate ACK if >= 10
- // packets are outstanding.
- return false;
- }
- if (skip_packet_number_for_pto_ && consecutive_pto_count_ > 0) {
- // An immediate ACK is expected when doing PTOS. Please note, this will miss
- // cases when PTO fires and turns out to be spurious.
- return false;
- }
- return true;
+ // Do not include max_ack_delay when PTO is armed for Initial or Handshake
+ // packet number spaces.
+ return !supports_multiple_packet_number_spaces() || space == APPLICATION_DATA;
}
QuicTime QuicSentPacketManager::GetEarliestPacketSentTimeForPto(
@@ -668,10 +501,9 @@
QuicPacketNumber packet_number, TransmissionType transmission_type) {
QuicTransmissionInfo* transmission_info =
unacked_packets_.GetMutableTransmissionInfo(packet_number);
- // A previous RTO retransmission may cause connection close; packets without
- // retransmittable frames can be marked for loss retransmissions.
+ // Packets without retransmittable frames can only be marked for loss
+ // retransmission.
QUIC_BUG_IF(quic_bug_12552_2, transmission_type != LOSS_RETRANSMISSION &&
- transmission_type != RTO_RETRANSMISSION &&
!unacked_packets_.HasRetransmittableFrames(
*transmission_info))
<< "packet number " << packet_number
@@ -898,17 +730,6 @@
MaybeInvokeCongestionEvent(false, prior_in_flight, now);
return LOSS_MODE;
}
- case TLP_MODE:
- ++stats_->tlp_count;
- ++consecutive_tlp_count_;
- pending_timer_transmission_count_ = 1;
- // TLPs prefer sending new data instead of retransmitting data, so
- // give the connection a chance to write before completing the TLP.
- return TLP_MODE;
- case RTO_MODE:
- ++stats_->rto_count;
- RetransmitRtoPackets();
- return RTO_MODE;
case PTO_MODE:
QUIC_DVLOG(1) << ENDPOINT << "PTO mode";
++stats_->pto_count;
@@ -916,7 +737,7 @@
++stats_->crypto_retransmit_count;
}
++consecutive_pto_count_;
- pending_timer_transmission_count_ = max_probe_packets_per_pto_;
+ pending_timer_transmission_count_ = 1;
return PTO_MODE;
}
QUIC_BUG(quic_bug_10750_3)
@@ -956,17 +777,6 @@
}
}
-bool QuicSentPacketManager::MaybeRetransmitTailLossProbe() {
- QUICHE_DCHECK(!pto_enabled_);
- if (pending_timer_transmission_count_ == 0) {
- return false;
- }
- if (!MaybeRetransmitOldestPacket(TLP_RETRANSMISSION)) {
- return false;
- }
- return true;
-}
-
bool QuicSentPacketManager::MaybeRetransmitOldestPacket(TransmissionType type) {
if (!unacked_packets_.empty()) {
QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
@@ -991,47 +801,7 @@
return false;
}
-void QuicSentPacketManager::RetransmitRtoPackets() {
- QUICHE_DCHECK(!pto_enabled_);
- QUIC_BUG_IF(quic_bug_12552_3, pending_timer_transmission_count_ > 0)
- << "Retransmissions already queued:" << pending_timer_transmission_count_;
- // Mark two packets for retransmission.
- std::vector<QuicPacketNumber> retransmissions;
- if (!unacked_packets_.empty()) {
- QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
- QuicPacketNumber largest_sent_packet =
- unacked_packets_.largest_sent_packet();
- for (; packet_number <= largest_sent_packet; ++packet_number) {
- QuicTransmissionInfo* transmission_info =
- unacked_packets_.GetMutableTransmissionInfo(packet_number);
- if (transmission_info->state == OUTSTANDING &&
- unacked_packets_.HasRetransmittableFrames(*transmission_info) &&
- pending_timer_transmission_count_ < max_rto_packets_) {
- QUICHE_DCHECK(transmission_info->in_flight);
- retransmissions.push_back(packet_number);
- ++pending_timer_transmission_count_;
- }
- }
- }
- if (pending_timer_transmission_count_ > 0) {
- if (consecutive_rto_count_ == 0) {
- first_rto_transmission_ = unacked_packets_.largest_sent_packet() + 1;
- }
- ++consecutive_rto_count_;
- }
- for (QuicPacketNumber retransmission : retransmissions) {
- MarkForRetransmission(retransmission, RTO_RETRANSMISSION);
- }
- if (retransmissions.empty()) {
- QUIC_BUG_IF(quic_bug_12552_4, pending_timer_transmission_count_ != 0);
- // No packets to be RTO retransmitted, raise up a credit to allow
- // connection to send.
- QUIC_CODE_COUNT(no_packets_to_be_rto_retransmitted);
- pending_timer_transmission_count_ = 1;
- }
-}
-
-void QuicSentPacketManager::MaybeSendProbePackets() {
+void QuicSentPacketManager::MaybeSendProbePacket() {
if (pending_timer_transmission_count_ == 0) {
return;
}
@@ -1077,42 +847,9 @@
// It is possible that there is not enough outstanding data for probing.
}
-void QuicSentPacketManager::AdjustPendingTimerTransmissions() {
- if (pending_timer_transmission_count_ < max_probe_packets_per_pto_) {
- // There are packets sent already, clear credit.
- pending_timer_transmission_count_ = 0;
- return;
- }
- // No packet gets sent, leave 1 credit to allow data to be write eventually.
- pending_timer_transmission_count_ = 1;
-}
-
void QuicSentPacketManager::EnableIetfPtoAndLossDetection() {
- if (pto_enabled_) {
- QUIC_RESTART_FLAG_COUNT_N(quic_default_on_pto2, 2, 2);
- // Disable handshake mode.
- handshake_mode_disabled_ = true;
- return;
- }
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- QUIC_BUG(pto_not_enabled)
- << "PTO is not enabled while quic_default_on_pto2 is true";
- return;
- }
- pto_enabled_ = true;
+ // Disable handshake mode.
handshake_mode_disabled_ = true;
- // Default to 1 packet per PTO and skip a packet number. Arm the 1st PTO
- // with max of earliest in flight sent time + PTO delay and 1.5 * srtt from
- // last in flight packet.
- max_probe_packets_per_pto_ = 1;
- skip_packet_number_for_pto_ = true;
- first_pto_srtt_multiplier_ = 1.5;
- pto_rttvar_multiplier_ = 2;
-}
-
-void QuicSentPacketManager::StartExponentialBackoffAfterNthPto(
- size_t exponential_backoff_start_point) {
- pto_exponential_backoff_start_point_ = exponential_backoff_start_point;
}
void QuicSentPacketManager::RetransmitDataOfSpaceIfAny(
@@ -1155,15 +892,7 @@
if (loss_algorithm_->GetLossTimeout() != QuicTime::Zero()) {
return LOSS_MODE;
}
- if (pto_enabled_) {
- return PTO_MODE;
- }
- if (consecutive_tlp_count_ < max_tail_loss_probes_) {
- if (unacked_packets_.HasUnackedRetransmittableFrames()) {
- return TLP_MODE;
- }
- }
- return RTO_MODE;
+ return PTO_MODE;
}
void QuicSentPacketManager::InvokeLossDetection(QuicTime time) {
@@ -1282,34 +1011,12 @@
GetCryptoRetransmissionDelay();
case LOSS_MODE:
return loss_algorithm_->GetLossTimeout();
- case TLP_MODE: {
- QUICHE_DCHECK(!pto_enabled_);
- // TODO(ianswett): When CWND is available, it would be preferable to
- // set the timer based on the earliest retransmittable packet.
- // Base the updated timer on the send time of the last packet.
- const QuicTime sent_time =
- unacked_packets_.GetLastInFlightPacketSentTime();
- const QuicTime tlp_time = sent_time + GetTailLossProbeDelay();
- // Ensure the TLP timer never gets set to a time in the past.
- return std::max(clock_->ApproximateNow(), tlp_time);
- }
- case RTO_MODE: {
- QUICHE_DCHECK(!pto_enabled_);
- // The RTO is based on the first outstanding packet.
- const QuicTime sent_time =
- unacked_packets_.GetLastInFlightPacketSentTime();
- QuicTime rto_time = sent_time + GetRetransmissionDelay();
- // Wait for TLP packets to be acked before an RTO fires.
- QuicTime tlp_time = sent_time + GetTailLossProbeDelay();
- return std::max(tlp_time, rto_time);
- }
case PTO_MODE: {
if (!supports_multiple_packet_number_spaces()) {
- if (first_pto_srtt_multiplier_ > 0 &&
- unacked_packets_.HasInFlightPackets() &&
+ if (unacked_packets_.HasInFlightPackets() &&
consecutive_pto_count_ == 0) {
// Arm 1st PTO with earliest in flight sent time, and make sure at
- // least first_pto_srtt_multiplier_ * RTT has been passed since last
+ // least kFirstPtoSrttMultiplier * RTT has been passed since last
// in flight packet.
return std::max(
clock_->ApproximateNow(),
@@ -1317,7 +1024,7 @@
->sent_time +
GetProbeTimeoutDelay(NUM_PACKET_NUMBER_SPACES),
unacked_packets_.GetLastInFlightPacketSentTime() +
- first_pto_srtt_multiplier_ *
+ kFirstPtoSrttMultiplier *
rtt_stats_.SmoothedOrInitialRtt()));
}
// Ensure PTO never gets set to a time in the past.
@@ -1335,22 +1042,21 @@
// Arm PTO from now if there is no in flight packets.
earliest_right_edge = clock_->ApproximateNow();
}
- if (first_pto_srtt_multiplier_ > 0 &&
- packet_number_space == APPLICATION_DATA &&
+ if (packet_number_space == APPLICATION_DATA &&
consecutive_pto_count_ == 0) {
const QuicTransmissionInfo* first_application_info =
unacked_packets_.GetFirstInFlightTransmissionInfoOfSpace(
APPLICATION_DATA);
if (first_application_info != nullptr) {
// Arm 1st PTO with earliest in flight sent time, and make sure at
- // least first_pto_srtt_multiplier_ * RTT has been passed since last
+ // least kFirstPtoSrttMultiplier * RTT has been passed since last
// in flight packet. Only do this for application data.
return std::max(
clock_->ApproximateNow(),
std::max(
first_application_info->sent_time +
GetProbeTimeoutDelay(packet_number_space),
- earliest_right_edge + first_pto_srtt_multiplier_ *
+ earliest_right_edge + kFirstPtoSrttMultiplier *
rtt_stats_.SmoothedOrInitialRtt()));
}
}
@@ -1364,18 +1070,14 @@
}
const QuicTime::Delta QuicSentPacketManager::GetPathDegradingDelay() const {
- if (pto_enabled_) {
- QUICHE_DCHECK_GT(num_ptos_for_path_degrading_, 0);
- return num_ptos_for_path_degrading_ * GetPtoDelay();
- }
- return GetNConsecutiveRetransmissionTimeoutDelay(
- max_tail_loss_probes_ + kNumRetransmissionDelaysForPathDegradingDelay);
+ QUICHE_DCHECK_GT(num_ptos_for_path_degrading_, 0);
+ return num_ptos_for_path_degrading_ * GetPtoDelay();
}
const QuicTime::Delta QuicSentPacketManager::GetNetworkBlackholeDelay(
int8_t num_rtos_for_blackhole_detection) const {
return GetNConsecutiveRetransmissionTimeoutDelay(
- max_tail_loss_probes_ + num_rtos_for_blackhole_detection);
+ kDefaultMaxTailLossProbes + num_rtos_for_blackhole_detection);
}
QuicTime::Delta QuicSentPacketManager::GetMtuReductionDelay(
@@ -1402,75 +1104,22 @@
delay_ms << consecutive_crypto_retransmission_count_);
}
-const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const {
- QuicTime::Delta srtt = rtt_stats_.SmoothedOrInitialRtt();
- if (!unacked_packets_.HasMultipleInFlightPackets()) {
- // This expression really should be using the delayed ack time, but in TCP
- // MinRTO was traditionally set to 2x the delayed ack timer and this
- // expression assumed QUIC did the same.
- return std::max(2 * srtt, 1.5 * srtt + (min_rto_timeout_ * 0.5));
- }
- return std::max(min_tlp_timeout_, 2 * srtt);
-}
-
-const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const {
- QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero();
- if (rtt_stats_.smoothed_rtt().IsZero()) {
- // We are in the initial state, use default timeout values.
- retransmission_delay =
- QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs);
- } else {
- retransmission_delay =
- rtt_stats_.smoothed_rtt() + 4 * rtt_stats_.mean_deviation();
- if (retransmission_delay < min_rto_timeout_) {
- retransmission_delay = min_rto_timeout_;
- }
- }
-
- // Calculate exponential back off.
- retransmission_delay =
- retransmission_delay *
- (1 << std::min<size_t>(consecutive_rto_count_, kMaxRetransmissions));
-
- if (retransmission_delay.ToMilliseconds() > kMaxRetransmissionTimeMs) {
- return QuicTime::Delta::FromMilliseconds(kMaxRetransmissionTimeMs);
- }
- return retransmission_delay;
-}
-
const QuicTime::Delta QuicSentPacketManager::GetProbeTimeoutDelay(
PacketNumberSpace space) const {
- QUICHE_DCHECK(pto_enabled_);
if (rtt_stats_.smoothed_rtt().IsZero()) {
// Respect kMinHandshakeTimeoutMs to avoid a potential amplification attack.
QUIC_BUG_IF(quic_bug_12552_6, rtt_stats_.initial_rtt().IsZero());
- return std::max(
- pto_multiplier_without_rtt_samples_ * rtt_stats_.initial_rtt(),
- QuicTime::Delta::FromMilliseconds(kMinHandshakeTimeoutMs)) *
+ return std::max(kPtoMultiplierWithoutRttSamples * rtt_stats_.initial_rtt(),
+ QuicTime::Delta::FromMilliseconds(kMinHandshakeTimeoutMs)) *
(1 << consecutive_pto_count_);
}
- const QuicTime::Delta rtt_var = use_standard_deviation_for_pto_
- ? rtt_stats_.GetStandardOrMeanDeviation()
- : rtt_stats_.mean_deviation();
QuicTime::Delta pto_delay =
rtt_stats_.smoothed_rtt() +
- std::max(pto_rttvar_multiplier_ * rtt_var, kAlarmGranularity) +
+ std::max(kPtoRttvarMultiplier * rtt_stats_.mean_deviation(),
+ kAlarmGranularity) +
(ShouldAddMaxAckDelay(space) ? peer_max_ack_delay_
: QuicTime::Delta::Zero());
- pto_delay =
- pto_delay * (1 << (consecutive_pto_count_ -
- std::min(consecutive_pto_count_,
- pto_exponential_backoff_start_point_)));
- if (consecutive_pto_count_ < num_tlp_timeout_ptos_) {
- // Make first n PTOs similar to TLPs.
- if (pto_delay > 2 * rtt_stats_.smoothed_rtt()) {
- QUIC_CODE_COUNT(quic_delayed_pto);
- pto_delay = std::max(kAlarmGranularity, 2 * rtt_stats_.smoothed_rtt());
- } else {
- QUIC_CODE_COUNT(quic_faster_pto);
- }
- }
- return pto_delay;
+ return pto_delay * (1 << consecutive_pto_count_);
}
QuicTime::Delta QuicSentPacketManager::GetSlowStartDuration() const {
@@ -1513,8 +1162,6 @@
std::unique_ptr<SendAlgorithmInterface>
QuicSentPacketManager::OnConnectionMigration(bool reset_send_algorithm) {
- consecutive_rto_count_ = 0;
- consecutive_tlp_count_ = 0;
consecutive_pto_count_ = 0;
rtt_stats_.OnConnectionMigration();
if (!reset_send_algorithm) {
@@ -1771,13 +1418,16 @@
QuicTime::Delta total_delay = QuicTime::Delta::Zero();
const QuicTime::Delta srtt = rtt_stats_.SmoothedOrInitialRtt();
int num_tlps =
- std::min(num_timeouts, static_cast<int>(max_tail_loss_probes_));
+ std::min(num_timeouts, static_cast<int>(kDefaultMaxTailLossProbes));
num_timeouts -= num_tlps;
if (num_tlps > 0) {
- const QuicTime::Delta tlp_delay =
- std::max(2 * srtt, unacked_packets_.HasMultipleInFlightPackets()
- ? min_tlp_timeout_
- : (1.5 * srtt + (min_rto_timeout_ * 0.5)));
+ const QuicTime::Delta tlp_delay = std::max(
+ 2 * srtt,
+ unacked_packets_.HasMultipleInFlightPackets()
+ ? QuicTime::Delta::FromMilliseconds(kMinTailLossProbeTimeoutMs)
+ : (1.5 * srtt +
+ (QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs) *
+ 0.5)));
total_delay = total_delay + num_tlps * tlp_delay;
}
if (num_timeouts == 0) {
@@ -1787,7 +1437,9 @@
const QuicTime::Delta retransmission_delay =
rtt_stats_.smoothed_rtt().IsZero()
? QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs)
- : std::max(srtt + 4 * rtt_stats_.mean_deviation(), min_rto_timeout_);
+ : std::max(
+ srtt + 4 * rtt_stats_.mean_deviation(),
+ QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs));
total_delay = total_delay + ((1 << num_timeouts) - 1) * retransmission_delay;
return total_delay;
}
@@ -1808,8 +1460,7 @@
}
QuicTime::Delta QuicSentPacketManager::GetPtoDelay() const {
- return pto_enabled_ ? GetProbeTimeoutDelay(APPLICATION_DATA)
- : GetRetransmissionDelay();
+ return GetProbeTimeoutDelay(APPLICATION_DATA);
}
void QuicSentPacketManager::OnAckFrequencyFrameSent(
diff --git a/quiche/quic/core/quic_sent_packet_manager.h b/quiche/quic/core/quic_sent_packet_manager.h
index d10eba0..04ba435 100644
--- a/quiche/quic/core/quic_sent_packet_manager.h
+++ b/quiche/quic/core/quic_sent_packet_manager.h
@@ -109,10 +109,6 @@
// The retransmission timer is a single timer which switches modes depending
// upon connection state.
enum RetransmissionTimeoutMode {
- // A conventional TCP style RTO.
- RTO_MODE,
- // A tail loss probe. By default, QUIC sends up to two before RTOing.
- TLP_MODE,
// Retransmission of handshake packets prior to handshake completion.
HANDSHAKE_MODE,
// Re-invoke the loss detection when a packet is not acked before the
@@ -175,10 +171,6 @@
void OnConfigNegotiated();
void OnConnectionClosed();
- // Retransmits the oldest pending packet there is still a tail loss probe
- // pending. Invoked after OnRetransmissionTimeout.
- bool MaybeRetransmitTailLossProbe();
-
// Retransmits the oldest pending packet.
bool MaybeRetransmitOldestPacket(TransmissionType type);
@@ -374,10 +366,6 @@
bool InSlowStart() const { return send_algorithm_->InSlowStart(); }
- size_t GetConsecutiveRtoCount() const { return consecutive_rto_count_; }
-
- size_t GetConsecutiveTlpCount() const { return consecutive_tlp_count_; }
-
size_t GetConsecutivePtoCount() const { return consecutive_pto_count_; }
void OnApplicationLimited();
@@ -409,7 +397,9 @@
void set_peer_max_ack_delay(QuicTime::Delta peer_max_ack_delay) {
// The delayed ack time should never be more than one half the min RTO time.
- QUICHE_DCHECK_LE(peer_max_ack_delay, (min_rto_timeout_ * 0.5));
+ QUICHE_DCHECK_LE(
+ peer_max_ack_delay,
+ (QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs) * 0.5));
peer_max_ack_delay_ = peer_max_ack_delay;
}
@@ -431,21 +421,13 @@
// Setting the send algorithm once the connection is underway is dangerous.
void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm);
- // Sends up to max_probe_packets_per_pto_ probe packets.
- void MaybeSendProbePackets();
-
- // Called to adjust pending_timer_transmission_count_ accordingly.
- void AdjustPendingTimerTransmissions();
+ // Sends one probe packet.
+ void MaybeSendProbePacket();
// Called to disable HANDSHAKE_MODE, and only PTO and LOSS modes are used.
// Also enable IETF loss detection.
void EnableIetfPtoAndLossDetection();
- // Called to set the start point of doing exponential backoff when calculating
- // PTO timeout.
- void StartExponentialBackoffAfterNthPto(
- size_t exponential_backoff_start_point);
-
// Called to retransmit in flight packet of |space| if any.
void RetransmitDataOfSpaceIfAny(PacketNumberSpace space);
@@ -459,14 +441,8 @@
return unacked_packets_.supports_multiple_packet_number_spaces();
}
- bool pto_enabled() const { return pto_enabled_; }
-
bool handshake_mode_disabled() const { return handshake_mode_disabled_; }
- bool skip_packet_number_for_pto() const {
- return skip_packet_number_for_pto_;
- }
-
bool zero_rtt_packet_acked() const { return zero_rtt_packet_acked_; }
bool one_rtt_packet_acked() const { return one_rtt_packet_acked_; }
@@ -504,21 +480,9 @@
// Retransmits all crypto stream packets.
void RetransmitCryptoPackets();
- // Retransmits two packets for an RTO and removes any non-retransmittable
- // packets from flight.
- void RetransmitRtoPackets();
-
// Returns the timeout for retransmitting crypto handshake packets.
const QuicTime::Delta GetCryptoRetransmissionDelay() const;
- // Calls GetTailLossProbeDelay() with values from the current state of this
- // packet manager as its params.
- const QuicTime::Delta GetTailLossProbeDelay() const;
-
- // Calls GetRetransmissionDelay() with values from the current state of this
- // packet manager as its params.
- const QuicTime::Delta GetRetransmissionDelay() const;
-
// Returns the probe timeout.
const QuicTime::Delta GetProbeTimeoutDelay(PacketNumberSpace space) const;
@@ -580,6 +544,7 @@
// A helper function to return total delay of |num_timeouts| retransmission
// timeout with TLP and RTO mode.
+ // TODO(fayang): remove this method and calculate blackhole delay by PTO.
QuicTime::Delta GetNConsecutiveRetransmissionTimeoutDelay(
int num_timeouts) const;
@@ -618,32 +583,14 @@
LossDetectionInterface* loss_algorithm_;
UberLossAlgorithm uber_loss_algorithm_;
- // Tracks the first RTO packet. If any packet before that packet gets acked,
- // it indicates the RTO was spurious and should be reversed(F-RTO).
- QuicPacketNumber first_rto_transmission_;
- // Number of times the RTO timer has fired in a row without receiving an ack.
- size_t consecutive_rto_count_;
- // Number of times the tail loss probe has been sent.
- size_t consecutive_tlp_count_;
// Number of times the crypto handshake has been retransmitted.
size_t consecutive_crypto_retransmission_count_;
- // Number of pending transmissions of TLP, RTO, or crypto packets.
+ // Number of pending transmissions of PTO or crypto packets.
size_t pending_timer_transmission_count_;
- // Maximum number of tail loss probes to send before firing an RTO.
- size_t max_tail_loss_probes_;
- // Maximum number of packets to send upon RTO.
- QuicPacketCount max_rto_packets_;
- // If true, send the TLP at 0.5 RTT.
+
bool using_pacing_;
- // If true, use the new RTO with loss based CWND reduction instead of the send
- // algorithms's OnRetransmissionTimeout to reduce the congestion window.
- bool use_new_rto_;
// If true, use a more conservative handshake retransmission policy.
bool conservative_handshake_retransmits_;
- // The minimum TLP timeout.
- QuicTime::Delta min_tlp_timeout_;
- // The minimum RTO.
- QuicTime::Delta min_rto_timeout_;
// Vectors packets acked and lost as a result of the last congestion event.
AckedPacketVector packets_acked_;
@@ -702,36 +649,12 @@
// OnAckRangeStart, and gradually moves in OnAckRange..
PacketNumberQueue::const_reverse_iterator acked_packets_iter_;
- // Indicates whether PTO mode has been enabled. PTO mode unifies TLP and RTO
- // modes.
- bool pto_enabled_;
-
- // Maximum number of probes to send when PTO fires.
- size_t max_probe_packets_per_pto_;
-
// Number of times the PTO timer has fired in a row without receiving an ack.
size_t consecutive_pto_count_;
// True if HANDSHAKE mode has been disabled.
bool handshake_mode_disabled_;
- // If true, skip packet number before sending the last PTO retransmission.
- bool skip_packet_number_for_pto_;
-
- // If true, always include peer_max_ack_delay_ when calculating PTO timeout.
- bool always_include_max_ack_delay_for_pto_timeout_;
-
- // When calculating PTO timeout, the start point of doing exponential backoff.
- // For example, 0 : always do exponential backoff. n : do exponential backoff
- // since nth PTO.
- size_t pto_exponential_backoff_start_point_;
-
- // The multiplier of rttvar when calculating PTO timeout.
- int pto_rttvar_multiplier_;
-
- // Number of PTOs similar to TLPs.
- size_t num_tlp_timeout_ptos_;
-
// True if any ENCRYPTION_HANDSHAKE packet gets acknowledged.
bool handshake_packet_acked_;
@@ -741,18 +664,6 @@
// True if any 1-RTT packet gets acknowledged.
bool one_rtt_packet_acked_;
- // If > 0, arm the 1st PTO with max of earliest in flight sent time + PTO
- // delay and multiplier * srtt from last in flight packet.
- float first_pto_srtt_multiplier_;
-
- // If true, use standard deviation (instead of mean deviation) when
- // calculating PTO timeout.
- bool use_standard_deviation_for_pto_;
-
- // The multiplier for caculating PTO timeout before any RTT sample is
- // available.
- float pto_multiplier_without_rtt_samples_;
-
// The number of PTOs needed for path degrading alarm. If equals to 0, the
// traditional path degrading mechanism will be used.
int num_ptos_for_path_degrading_;
diff --git a/quiche/quic/core/quic_sent_packet_manager_test.cc b/quiche/quic/core/quic_sent_packet_manager_test.cc
index 24485e2..9c8db65 100644
--- a/quiche/quic/core/quic_sent_packet_manager_test.cc
+++ b/quiche/quic/core/quic_sent_packet_manager_test.cc
@@ -98,8 +98,6 @@
send_algorithm_(new StrictMock<MockSendAlgorithm>),
network_change_visitor_(new StrictMock<MockNetworkChangeVisitor>) {
QuicSentPacketManagerPeer::SetSendAlgorithm(&manager_, send_algorithm_);
- // Disable tail loss probes for most tests.
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 0);
// Advance the time 1s so the send times are never QuicTime::Zero.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000));
manager_.SetNetworkChangeVisitor(network_change_visitor_.get());
@@ -202,7 +200,7 @@
void RetransmitAndSendPacket(uint64_t old_packet_number,
uint64_t new_packet_number) {
RetransmitAndSendPacket(old_packet_number, new_packet_number,
- TLP_RETRANSMISSION);
+ PTO_RETRANSMISSION);
}
void RetransmitAndSendPacket(uint64_t old_packet_number,
@@ -210,8 +208,7 @@
TransmissionType transmission_type) {
bool is_lost = false;
if (transmission_type == HANDSHAKE_RETRANSMISSION ||
- transmission_type == TLP_RETRANSMISSION ||
- transmission_type == RTO_RETRANSMISSION ||
+ transmission_type == PTO_RETRANSMISSION ||
transmission_type == PROBING_RETRANSMISSION) {
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
.WillOnce(WithArgs<1>(
@@ -316,25 +313,6 @@
NO_RETRANSMITTABLE_DATA, true);
}
- void EnablePto(QuicTag tag) {
- QuicConfig config;
- QuicTagVector options;
- options.push_back(tag);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.pto_enabled());
- }
-
- int GetPtoRttvarMultiplier() {
- if (GetQuicRestartFlag(quic_default_on_pto2) ||
- manager_.handshake_mode_disabled()) {
- return 2;
- }
- return 4;
- }
-
quiche::SimpleBufferAllocator allocator_;
QuicSentPacketManager manager_;
MockClock clock_;
@@ -393,7 +371,7 @@
return RetransmitDataPacket(2, type);
})));
QuicSentPacketManagerPeer::MarkForRetransmission(&manager_, 1,
- TLP_RETRANSMISSION);
+ PTO_RETRANSMISSION);
// Ack 1.
ExpectAck(1);
manager_.OnAckFrameStart(QuicPacketNumber(1), QuicTime::Delta::Infinite(),
@@ -415,7 +393,7 @@
SendDataPacket(1);
EXPECT_CALL(notifier_, RetransmitFrames(_, _)).WillRepeatedly(Return(true));
QuicSentPacketManagerPeer::MarkForRetransmission(&manager_, 1,
- TLP_RETRANSMISSION);
+ PTO_RETRANSMISSION);
EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(false));
@@ -552,7 +530,7 @@
TEST_F(QuicSentPacketManagerTest, RetransmitTwiceThenAckFirst) {
StrictMock<MockDebugDelegate> debug_delegate;
- EXPECT_CALL(debug_delegate, OnSpuriousPacketRetransmission(TLP_RETRANSMISSION,
+ EXPECT_CALL(debug_delegate, OnSpuriousPacketRetransmission(PTO_RETRANSMISSION,
kDefaultLength))
.Times(1);
manager_.SetDebugDelegate(&debug_delegate);
@@ -831,155 +809,6 @@
EXPECT_EQ(expected_rtt, manager_.GetRttStats()->latest_rtt());
}
-TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeout) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
-
- // Send 1 packet.
- SendDataPacket(1);
-
- // The first tail loss probe retransmits 1 packet.
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(2, type);
- })));
- manager_.MaybeRetransmitTailLossProbe();
-
- // The second tail loss probe retransmits 1 packet.
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type);
- })));
- manager_.MaybeRetransmitTailLossProbe();
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(Return(false));
- EXPECT_EQ(QuicTime::Delta::Infinite(), manager_.TimeUntilSend(clock_.Now()));
-
- // Ack the third and ensure the first two are still pending.
- ExpectAck(3);
-
- manager_.OnAckFrameStart(QuicPacketNumber(3), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(3), QuicPacketNumber(4));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-
- EXPECT_TRUE(manager_.HasInFlightPackets());
-
- // Acking two more packets will lose both of them due to nacks.
- SendDataPacket(4);
- SendDataPacket(5);
- uint64_t acked[] = {4, 5};
- uint64_t lost[] = {1, 2};
- ExpectAcksAndLosses(true, acked, ABSL_ARRAYSIZE(acked), lost,
- ABSL_ARRAYSIZE(lost));
- // Frames in all packets are acked.
- EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(false));
- // Notify session that stream frame in packets 1 and 2 get lost although
- // they are not outstanding.
- EXPECT_CALL(notifier_, OnFrameLost(_)).Times(2);
- manager_.OnAckFrameStart(QuicPacketNumber(5), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(3), QuicPacketNumber(6));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(2),
- ENCRYPTION_INITIAL));
-
- EXPECT_FALSE(manager_.HasInFlightPackets());
- EXPECT_EQ(2u, stats_.tlp_count);
- EXPECT_EQ(0u, stats_.rto_count);
-}
-
-TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
-
- // Send 100 packets.
- const size_t kNumSentPackets = 100;
- for (size_t i = 1; i <= kNumSentPackets; ++i) {
- SendDataPacket(i);
- }
- QuicTime rto_packet_time = clock_.Now();
- // Advance the time.
- clock_.AdvanceTime(manager_.GetRetransmissionTime() - clock_.Now());
-
- // The first tail loss probe retransmits 1 packet.
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(101, type);
- })));
- manager_.MaybeRetransmitTailLossProbe();
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(Return(false));
- EXPECT_EQ(QuicTime::Delta::Infinite(), manager_.TimeUntilSend(clock_.Now()));
- clock_.AdvanceTime(manager_.GetRetransmissionTime() - clock_.Now());
-
- // The second tail loss probe retransmits 1 packet.
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(102, type);
- })));
- EXPECT_TRUE(manager_.MaybeRetransmitTailLossProbe());
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(Return(false));
- EXPECT_EQ(QuicTime::Delta::Infinite(), manager_.TimeUntilSend(clock_.Now()));
-
- // Ensure the RTO is set based on the correct packet.
- rto_packet_time = clock_.Now();
- EXPECT_EQ(rto_packet_time + QuicTime::Delta::FromMilliseconds(500),
- manager_.GetRetransmissionTime());
-
- // Advance the time enough to ensure all packets are RTO'd.
- clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1000));
-
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(103, type);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(104, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(2u, stats_.tlp_count);
- EXPECT_EQ(1u, stats_.rto_count);
- EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress);
- // There are 2 RTO retransmissions.
- EXPECT_EQ(104 * kDefaultLength, manager_.GetBytesInFlight());
- QuicPacketNumber largest_acked = QuicPacketNumber(103);
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- EXPECT_CALL(*send_algorithm_,
- OnCongestionEvent(
- true, _, _, Pointwise(PacketNumberEq(), {largest_acked}), _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- // Although frames in packet 3 gets acked, it would be kept for another
- // RTT.
- EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(true));
- // Packets [1, 102] are lost, although stream frame in packet 3 is not
- // outstanding.
- EXPECT_CALL(notifier_, OnFrameLost(_)).Times(102);
- manager_.OnAckFrameStart(QuicPacketNumber(103), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(103), QuicPacketNumber(104));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
- // All packets before 103 should be lost.
- // Packet 104 is still in flight.
- EXPECT_EQ(1000u, manager_.GetBytesInFlight());
- EXPECT_EQ(1u, stats_.max_consecutive_rto_with_forward_progress);
-}
-
TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeout) {
// Send 2 crypto packets and 3 data packets.
const size_t kNumSentCryptoPackets = 2;
@@ -1137,225 +966,6 @@
VerifyRetransmittablePackets(nullptr, 0);
}
-TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- StrictMock<MockDebugDelegate> debug_delegate;
- manager_.SetDebugDelegate(&debug_delegate);
-
- // Send 100 packets.
- const size_t kNumSentPackets = 100;
- for (size_t i = 1; i <= kNumSentPackets; ++i) {
- SendDataPacket(i);
- }
-
- EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe());
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(101, type);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(102, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(102 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Ack a retransmission.
- // Ensure no packets are lost.
- QuicPacketNumber largest_acked = QuicPacketNumber(102);
- EXPECT_CALL(*send_algorithm_,
- OnCongestionEvent(true, _, _,
- Pointwise(PacketNumberEq(), {largest_acked}),
- /*lost_packets=*/IsEmpty()));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- // RTO's use loss detection instead of immediately declaring retransmitted
- // packets lost.
- for (int i = 1; i <= 99; ++i) {
- EXPECT_CALL(debug_delegate,
- OnPacketLoss(QuicPacketNumber(i), _, LOSS_RETRANSMISSION, _));
- }
- EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(true));
- // Packets [1, 99] are considered as lost, although stream frame in packet
- // 2 is not outstanding.
- EXPECT_CALL(notifier_, OnFrameLost(_)).Times(99);
- manager_.OnAckFrameStart(QuicPacketNumber(102), QuicTime::Delta::Zero(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(102), QuicPacketNumber(103));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-}
-
-TEST_F(QuicSentPacketManagerTest, RetransmissionTimeoutOnePacket) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- // Set the 1RTO connection option.
- QuicConfig client_config;
- QuicTagVector options;
- options.push_back(k1RTO);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- manager_.SetFromConfig(client_config);
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
-
- StrictMock<MockDebugDelegate> debug_delegate;
- manager_.SetDebugDelegate(&debug_delegate);
-
- // Send 100 packets.
- const size_t kNumSentPackets = 100;
- for (size_t i = 1; i <= kNumSentPackets; ++i) {
- SendDataPacket(i);
- }
-
- EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe());
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(1)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(101, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(101 * kDefaultLength, manager_.GetBytesInFlight());
-}
-
-TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig client_config;
- QuicTagVector options;
- options.push_back(kNRTO);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- manager_.SetFromConfig(client_config);
- EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
-
- // Send 100 packets.
- const size_t kNumSentPackets = 100;
- for (size_t i = 1; i <= kNumSentPackets; ++i) {
- SendDataPacket(i);
- }
-
- EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe());
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(101, type);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(102, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(102 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Ack a retransmission and expect no call to OnRetransmissionTimeout.
- // This will include packets in the lost packet map.
- QuicPacketNumber largest_acked = QuicPacketNumber(102);
- EXPECT_CALL(*send_algorithm_,
- OnCongestionEvent(true, _, _,
- Pointwise(PacketNumberEq(), {largest_acked}),
- /*lost_packets=*/Not(IsEmpty())));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(true));
- // Packets [1, 99] are considered as lost, although stream frame in packet
- // 2 is not outstanding.
- EXPECT_CALL(notifier_, OnFrameLost(_)).Times(99);
- manager_.OnAckFrameStart(QuicPacketNumber(102), QuicTime::Delta::Zero(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(102), QuicPacketNumber(103));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-}
-
-TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- // Send 1 packet.
- SendDataPacket(1);
-
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(2, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(2 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Rto a second time.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(3 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Ack a retransmission and ensure OnRetransmissionTimeout is called.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- ExpectAck(2);
- manager_.OnAckFrameStart(QuicPacketNumber(2), QuicTime::Delta::Zero(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(2), QuicPacketNumber(3));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-
- // The original packet and newest should be outstanding.
- EXPECT_EQ(2 * kDefaultLength, manager_.GetBytesInFlight());
-}
-
-TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- // Send 1 packet.
- SendDataPacket(1);
-
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(2, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(2 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Rto a second time.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(3 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Ack a retransmission and ensure OnRetransmissionTimeout is called.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- ExpectAck(3);
- manager_.OnAckFrameStart(QuicPacketNumber(3), QuicTime::Delta::Zero(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(3), QuicPacketNumber(4));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-
- // The first two packets should still be outstanding.
- EXPECT_EQ(2 * kDefaultLength, manager_.GetBytesInFlight());
-}
-
TEST_F(QuicSentPacketManagerTest, GetTransmissionTime) {
EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime());
}
@@ -1448,199 +1058,6 @@
EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
}
-TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeTailLossProbe) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
- SendDataPacket(1);
- SendDataPacket(2);
-
- // Check the min.
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->set_initial_rtt(QuicTime::Delta::FromMilliseconds(1));
- EXPECT_EQ(clock_.Now() + QuicTime::Delta::FromMilliseconds(10),
- manager_.GetRetransmissionTime());
-
- // Test with a standard smoothed RTT.
- rtt_stats->set_initial_rtt(QuicTime::Delta::FromMilliseconds(100));
- QuicTime::Delta srtt = rtt_stats->initial_rtt();
- QuicTime::Delta expected_tlp_delay = 2 * srtt;
- QuicTime expected_time = clock_.Now() + expected_tlp_delay;
- EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
-
- // Retransmit the packet by invoking the retransmission timeout.
- clock_.AdvanceTime(expected_tlp_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type);
- })));
- EXPECT_TRUE(manager_.MaybeRetransmitTailLossProbe());
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(Return(false));
- EXPECT_EQ(QuicTime::Delta::Infinite(), manager_.TimeUntilSend(clock_.Now()));
-
- expected_time = clock_.Now() + expected_tlp_delay;
- EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
-}
-
-TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeSpuriousRTO) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
-
- SendDataPacket(1);
- SendDataPacket(2);
- SendDataPacket(3);
- SendDataPacket(4);
-
- QuicTime::Delta expected_rto_delay =
- rtt_stats->smoothed_rtt() + 4 * rtt_stats->mean_deviation();
- QuicTime expected_time = clock_.Now() + expected_rto_delay;
- EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
-
- // Retransmit the packet by invoking the retransmission timeout.
- clock_.AdvanceTime(expected_rto_delay);
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(5, type);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(6, type);
- })));
- manager_.OnRetransmissionTimeout();
- // All previous packets are inflight, plus two rto retransmissions.
- EXPECT_EQ(6 * kDefaultLength, manager_.GetBytesInFlight());
-
- // The delay should double the second time.
- expected_time = clock_.Now() + expected_rto_delay + expected_rto_delay;
- // Once we always base the timer on the right edge, leaving the older packets
- // in flight doesn't change the timeout.
- EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
-
- // Ack a packet before the first RTO and ensure the RTO timeout returns to the
- // original value and OnRetransmissionTimeout is not called or reverted.
- uint64_t acked[] = {1, 2};
- ExpectAcksAndLosses(true, acked, ABSL_ARRAYSIZE(acked), nullptr, 0);
- manager_.OnAckFrameStart(QuicPacketNumber(2), QuicTime::Delta::Zero(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(1), QuicPacketNumber(3));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
- EXPECT_EQ(4 * kDefaultLength, manager_.GetBytesInFlight());
-
- // Wait 2RTTs from now for the RTO, since it's the max of the RTO time
- // and the TLP time. In production, there would always be two TLP's first.
- // Since retransmission was spurious, smoothed_rtt_ is expired, and replaced
- // by the latest RTT sample of 500ms.
- expected_time = clock_.Now() + QuicTime::Delta::FromMilliseconds(1000);
- // Once we always base the timer on the right edge, leaving the older packets
- // in flight doesn't change the timeout.
- EXPECT_EQ(expected_time, manager_.GetRetransmissionTime());
-}
-
-TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- SendDataPacket(1);
- // Provide a 1ms RTT sample.
- const_cast<RttStats*>(manager_.GetRttStats())
- ->UpdateRtt(QuicTime::Delta::FromMilliseconds(1), QuicTime::Delta::Zero(),
- QuicTime::Zero());
- QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(200);
-
- // If the delay is smaller than the min, ensure it exponentially backs off
- // from the min.
- for (int i = 0; i < 5; ++i) {
- EXPECT_EQ(delay,
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
- delay = delay + delay;
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this, i](TransmissionType type) {
- return RetransmitDataPacket(i + 2, type);
- })));
- manager_.OnRetransmissionTimeout();
- }
-}
-
-TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMax) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- SendDataPacket(1);
- // Provide a 60s RTT sample.
- const_cast<RttStats*>(manager_.GetRttStats())
- ->UpdateRtt(QuicTime::Delta::FromSeconds(60), QuicTime::Delta::Zero(),
- QuicTime::Zero());
-
- EXPECT_EQ(QuicTime::Delta::FromSeconds(60),
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayExponentialBackoff) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- SendDataPacket(1);
- QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(500);
-
- // Delay should back off exponentially.
- for (int i = 0; i < 5; ++i) {
- EXPECT_EQ(delay,
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
- delay = delay + delay;
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this, i](TransmissionType type) {
- return RetransmitDataPacket(i + 2, type);
- })));
- manager_.OnRetransmissionTimeout();
- }
-}
-
-TEST_F(QuicSentPacketManagerTest, RetransmissionDelay) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- const int64_t kRttMs = 250;
- const int64_t kDeviationMs = 5;
-
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kRttMs),
- QuicTime::Delta::Zero(), clock_.Now());
-
- // Initial value is to set the median deviation to half of the initial rtt,
- // the median in then multiplied by a factor of 4 and finally the smoothed rtt
- // is added which is the initial rtt.
- QuicTime::Delta expected_delay =
- QuicTime::Delta::FromMilliseconds(kRttMs + kRttMs / 2 * 4);
- EXPECT_EQ(expected_delay,
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
-
- for (int i = 0; i < 100; ++i) {
- // Run to make sure that we converge.
- rtt_stats->UpdateRtt(
- QuicTime::Delta::FromMilliseconds(kRttMs + kDeviationMs),
- QuicTime::Delta::Zero(), clock_.Now());
- rtt_stats->UpdateRtt(
- QuicTime::Delta::FromMilliseconds(kRttMs - kDeviationMs),
- QuicTime::Delta::Zero(), clock_.Now());
- }
- expected_delay = QuicTime::Delta::FromMilliseconds(kRttMs + kDeviationMs * 4);
-
- EXPECT_NEAR(kRttMs, rtt_stats->smoothed_rtt().ToMilliseconds(), 1);
- EXPECT_NEAR(expected_delay.ToMilliseconds(),
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)
- .ToMilliseconds(),
- 1);
-}
-
TEST_F(QuicSentPacketManagerTest, GetLossDelay) {
auto loss_algorithm = std::make_unique<MockLossAlgorithm>();
QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm.get());
@@ -1868,214 +1285,6 @@
->GetCongestionControlType());
}
-TEST_F(QuicSentPacketManagerTest, NegotiateNoMinTLPFromOptionsAtServer) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig config;
- QuicTagVector options;
-
- options.push_back(kMAD2);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillOnce(Return(10 * kDefaultTCPMSS));
- manager_.SetFromConfig(config);
- // Set the initial RTT to 1us.
- QuicSentPacketManagerPeer::GetRttStats(&manager_)->set_initial_rtt(
- QuicTime::Delta::FromMicroseconds(1));
- // The TLP with fewer than 2 packets outstanding includes 1/2 min RTO(200ms).
- EXPECT_EQ(QuicTime::Delta::FromMicroseconds(100002),
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
-
- // Send two packets, and the TLP should be 1ms.
- QuicTime::Delta expected_tlp_delay = QuicTime::Delta::FromMilliseconds(1);
- SendDataPacket(1);
- SendDataPacket(2);
- EXPECT_EQ(expected_tlp_delay,
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNoMinTLPFromOptionsAtClient) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig client_config;
- QuicTagVector options;
-
- options.push_back(kMAD2);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillOnce(Return(10 * kDefaultTCPMSS));
- manager_.SetFromConfig(client_config);
- // Set the initial RTT to 1us.
- QuicSentPacketManagerPeer::GetRttStats(&manager_)->set_initial_rtt(
- QuicTime::Delta::FromMicroseconds(1));
- // The TLP with fewer than 2 packets outstanding includes 1/2 min RTO(200ms).
- EXPECT_EQ(QuicTime::Delta::FromMicroseconds(100002),
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
- // Send two packets, and the TLP should be 1ms.
- QuicTime::Delta expected_tlp_delay = QuicTime::Delta::FromMilliseconds(1);
- SendDataPacket(1);
- SendDataPacket(2);
- EXPECT_EQ(expected_tlp_delay,
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNoMinRTOFromOptionsAtServer) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig config;
- QuicTagVector options;
-
- options.push_back(kMAD3);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(config);
- // Provide one RTT measurement, because otherwise we use the default of 500ms.
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMicroseconds(1),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta expected_rto_delay = QuicTime::Delta::FromMilliseconds(1);
- EXPECT_EQ(expected_rto_delay,
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
- // The TLP with fewer than 2 packets outstanding includes 1/2 min RTO(0ms).
- QuicTime::Delta expected_tlp_delay = QuicTime::Delta::FromMicroseconds(502);
- EXPECT_EQ(expected_tlp_delay,
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNoMinRTOFromOptionsAtClient) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig client_config;
- QuicTagVector options;
-
- options.push_back(kMAD3);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(client_config);
- // Provide one RTT measurement, because otherwise we use the default of 500ms.
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMicroseconds(1),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta expected_rto_delay = QuicTime::Delta::FromMilliseconds(1);
- EXPECT_EQ(expected_rto_delay,
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_));
- // The TLP with fewer than 2 packets outstanding includes 1/2 min RTO(0ms).
- QuicTime::Delta expected_tlp_delay = QuicTime::Delta::FromMicroseconds(502);
- EXPECT_EQ(expected_tlp_delay,
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig config;
- QuicTagVector options;
-
- options.push_back(kNTLP);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(config);
- EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig client_config;
- QuicTagVector options;
-
- options.push_back(kNTLP);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(client_config);
- EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, Negotiate1TLPFromOptionsAtServer) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig config;
- QuicTagVector options;
-
- options.push_back(k1TLP);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(config);
- EXPECT_EQ(1u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, Negotiate1TLPFromOptionsAtClient) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicConfig client_config;
- QuicTagVector options;
-
- options.push_back(k1TLP);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(client_config);
- EXPECT_EQ(1u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
- QuicConfig config;
- QuicTagVector options;
-
- options.push_back(kNRTO);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(config);
- EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
-}
-
-TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
- QuicConfig client_config;
- QuicTagVector options;
-
- options.push_back(kNRTO);
- QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- manager_.SetFromConfig(client_config);
- EXPECT_TRUE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_));
-}
-
TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
QuicTime::Delta initial_rtt = QuicTime::Delta::FromMilliseconds(325);
EXPECT_NE(initial_rtt, manager_.GetRttStats()->smoothed_rtt());
@@ -2116,18 +1325,15 @@
rtt_stats->set_initial_rtt(default_init_rtt * 2);
EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(&manager_, 1);
- EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount());
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, 2);
- EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount());
+ QuicSentPacketManagerPeer::SetConsecutivePtoCount(&manager_, 1);
+ EXPECT_EQ(1u, manager_.GetConsecutivePtoCount());
EXPECT_CALL(*send_algorithm_, OnConnectionMigration());
EXPECT_EQ(nullptr,
manager_.OnConnectionMigration(/*reset_send_algorithm=*/false));
EXPECT_EQ(default_init_rtt, rtt_stats->initial_rtt());
- EXPECT_EQ(0u, manager_.GetConsecutiveRtoCount());
- EXPECT_EQ(0u, manager_.GetConsecutiveTlpCount());
+ EXPECT_EQ(0u, manager_.GetConsecutivePtoCount());
}
// Tests that ResetCongestionControlUponPeerAddressChange() resets send
@@ -2142,10 +1348,8 @@
rtt_stats->set_initial_rtt(default_init_rtt * 2);
EXPECT_EQ(2 * default_init_rtt, rtt_stats->initial_rtt());
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(&manager_, 1);
- EXPECT_EQ(1u, manager_.GetConsecutiveRtoCount());
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, 2);
- EXPECT_EQ(2u, manager_.GetConsecutiveTlpCount());
+ QuicSentPacketManagerPeer::SetConsecutivePtoCount(&manager_, 1);
+ EXPECT_EQ(1u, manager_.GetConsecutivePtoCount());
SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
@@ -2161,8 +1365,7 @@
EXPECT_EQ(old_send_algorithm->GetCongestionControlType(),
manager_.GetSendAlgorithm()->GetCongestionControlType());
EXPECT_EQ(default_init_rtt, rtt_stats->initial_rtt());
- EXPECT_EQ(0u, manager_.GetConsecutiveRtoCount());
- EXPECT_EQ(0u, manager_.GetConsecutiveTlpCount());
+ EXPECT_EQ(0u, manager_.GetConsecutivePtoCount());
// Packets sent earlier shouldn't be regarded as in flight.
EXPECT_EQ(0u, BytesInFlight());
@@ -2245,8 +1448,7 @@
EXPECT_EQ(old_send_algorithm->GetCongestionControlType(),
manager_.GetSendAlgorithm()->GetCongestionControlType());
EXPECT_EQ(default_init_rtt, rtt_stats->initial_rtt());
- EXPECT_EQ(0u, manager_.GetConsecutiveRtoCount());
- EXPECT_EQ(0u, manager_.GetConsecutiveTlpCount());
+ EXPECT_EQ(0u, manager_.GetConsecutivePtoCount());
EXPECT_EQ(0u, BytesInFlight());
EXPECT_TRUE(manager_.GetRttStats()->latest_rtt().IsZero());
@@ -2317,8 +1519,7 @@
old_send_algorithm =
manager_.OnConnectionMigration(/*reset_send_algorithm=*/true);
EXPECT_EQ(default_init_rtt, rtt_stats->initial_rtt());
- EXPECT_EQ(0u, manager_.GetConsecutiveRtoCount());
- EXPECT_EQ(0u, manager_.GetConsecutiveTlpCount());
+ EXPECT_EQ(0u, manager_.GetConsecutivePtoCount());
EXPECT_EQ(0u, BytesInFlight());
EXPECT_TRUE(manager_.GetRttStats()->latest_rtt().IsZero());
@@ -2622,94 +1823,7 @@
ENCRYPTION_HANDSHAKE));
}
-// Regression test for b/133771183.
-TEST_F(QuicSentPacketManagerTest, PacketInLimbo) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
- // Send SHLO.
- SendCryptoPacket(1);
- // Send data packet.
- SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
- // Send Ack Packet.
- SendAckPacket(3, 1, ENCRYPTION_FORWARD_SECURE);
- // Retransmit SHLO.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(
- InvokeWithoutArgs([this]() { return RetransmitCryptoPacket(4); }));
- manager_.OnRetransmissionTimeout();
-
- // Successfully decrypt a forward secure packet.
- manager_.SetHandshakeConfirmed();
- EXPECT_CALL(notifier_, HasUnackedCryptoData()).WillRepeatedly(Return(false));
- // Send Ack packet.
- SendAckPacket(5, 2, ENCRYPTION_FORWARD_SECURE);
-
- // Retransmission alarm fires.
- manager_.OnRetransmissionTimeout();
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(6, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeRetransmitTailLossProbe();
-
- // Received Ack of packets 1, 3 and 4.
- uint64_t acked[] = {1, 3, 4};
- ExpectAcksAndLosses(true, acked, ABSL_ARRAYSIZE(acked), nullptr, 0);
- manager_.OnAckFrameStart(QuicPacketNumber(4), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(3), QuicPacketNumber(5));
- manager_.OnAckRange(QuicPacketNumber(1), QuicPacketNumber(2));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_INITIAL));
-
- uint64_t acked2[] = {5, 6};
- uint64_t loss[] = {2};
- // Verify packet 2 is detected lost.
- EXPECT_CALL(notifier_, OnFrameLost(_)).Times(1);
- ExpectAcksAndLosses(true, acked2, ABSL_ARRAYSIZE(acked2), loss,
- ABSL_ARRAYSIZE(loss));
- manager_.OnAckFrameStart(QuicPacketNumber(6), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(3), QuicPacketNumber(7));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(2),
- ENCRYPTION_INITIAL));
-}
-
-TEST_F(QuicSentPacketManagerTest, RtoFiresNoPacketToRetransmit) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- // Send 10 packets.
- for (size_t i = 1; i <= 10; ++i) {
- SendDataPacket(i);
- }
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(11, type);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(12, type);
- })));
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(1u, stats_.rto_count);
- EXPECT_EQ(0u, manager_.pending_timer_transmission_count());
-
- // RTO fires again, but there is no packet to be RTO retransmitted.
- EXPECT_CALL(notifier_, IsFrameOutstanding(_)).WillRepeatedly(Return(false));
- EXPECT_CALL(notifier_, RetransmitFrames(_, _)).Times(0);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(2u, stats_.rto_count);
- // Verify a credit is raised up.
- EXPECT_EQ(1u, manager_.pending_timer_transmission_count());
-}
-
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeout) {
- EnablePto(k2PTO);
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -2722,7 +1836,7 @@
SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
QuicTime packet1_sent_time = clock_.Now();
EXPECT_EQ(clock_.Now() + expected_pto_delay,
@@ -2730,12 +1844,8 @@
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set based on sent time of packet 2.
- QuicTime deadline = clock_.Now() + expected_pto_delay;
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- // Verify PTO is set based on left edge.
- deadline = packet1_sent_time + expected_pto_delay;
- }
+ // Verify PTO is set based on left edge.
+ QuicTime deadline = packet1_sent_time + expected_pto_delay;
EXPECT_EQ(deadline, manager_.GetRetransmissionTime());
EXPECT_EQ(0u, stats_.pto_count);
@@ -2746,23 +1856,11 @@
EXPECT_EQ(1u, stats_.pto_count);
EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress);
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
- } else {
- // Verify two probe packets get sent.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(4, type, ENCRYPTION_FORWARD_SECURE);
- })));
- }
- manager_.MaybeSendProbePackets();
+ EXPECT_CALL(notifier_, RetransmitFrames(_, _))
+ .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
+ return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
+ })));
+ manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value.
QuicTime sent_time = clock_.Now();
EXPECT_EQ(sent_time + expected_pto_delay * 2,
@@ -2779,7 +1877,7 @@
ENCRYPTION_FORWARD_SECURE));
expected_pto_delay =
rtt_stats->SmoothedOrInitialRtt() +
- std::max(GetPtoRttvarMultiplier() * rtt_stats->mean_deviation(),
+ std::max(kPtoRttvarMultiplier * rtt_stats->mean_deviation(),
QuicTime::Delta::FromMilliseconds(1)) +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
@@ -2789,7 +1887,6 @@
}
TEST_F(QuicSentPacketManagerTest, SendOneProbePacket) {
- EnablePto(k1PTO);
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -2806,13 +1903,10 @@
QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
// Verify PTO period is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- QuicTime deadline = clock_.Now() + expected_pto_delay;
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- // Verify PTO is set based on left edge.
- deadline = packet1_sent_time + expected_pto_delay;
- }
+ // Verify PTO is set based on left edge.
+ QuicTime deadline = packet1_sent_time + expected_pto_delay;
EXPECT_EQ(deadline, manager_.GetRetransmissionTime());
// Invoke PTO.
@@ -2825,7 +1919,7 @@
.WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
})));
- manager_.MaybeSendProbePackets();
+ manager_.MaybeSendProbePacket();
}
TEST_F(QuicSentPacketManagerTest, DisableHandshakeModeClient) {
@@ -2883,269 +1977,7 @@
EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime());
}
-TEST_F(QuicSentPacketManagerTest, PtoTimeoutIncludesMaxAckDelay) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EnablePto(k1PTO);
- // Use PTOS and PTOA.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPTOA);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
-
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
-
- SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
- QuicTime packet1_sent_time = clock_.Now();
- // Verify PTO is correctly set and ack delay is included.
- QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
- SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set based on sent time of packet 2 but ack delay is
- // not included as an immediate ACK is expected.
- expected_pto_delay = expected_pto_delay - QuicTime::Delta::FromMilliseconds(
- kDefaultDelayedAckTimeMs);
- QuicTime deadline = clock_.Now() + expected_pto_delay;
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- deadline = packet1_sent_time + expected_pto_delay;
- }
- EXPECT_EQ(deadline, manager_.GetRetransmissionTime());
- EXPECT_EQ(0u, stats_.pto_count);
-
- // Invoke PTO.
- clock_.AdvanceTime(deadline - clock_.Now());
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(1u, stats_.pto_count);
-
- // Verify 1 probe packets get sent and packet number gets skipped.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(4, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- // Verify PTO period gets set to twice the current value. Also, ack delay is
- // not included.
- QuicTime sent_time = clock_.Now();
- EXPECT_EQ(sent_time + expected_pto_delay * 2,
- manager_.GetRetransmissionTime());
-
- // Received ACK for packets 1 and 2.
- uint64_t acked[] = {1, 2};
- ExpectAcksAndLosses(true, acked, ABSL_ARRAYSIZE(acked), nullptr, 0);
- manager_.OnAckFrameStart(QuicPacketNumber(2), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(1), QuicPacketNumber(3));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(1),
- ENCRYPTION_FORWARD_SECURE));
- expected_pto_delay =
- rtt_stats->SmoothedOrInitialRtt() +
- std::max(GetPtoRttvarMultiplier() * rtt_stats->mean_deviation(),
- QuicTime::Delta::FromMilliseconds(1)) +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
-
- // Verify PTO is correctly re-armed based on sent time of packet 4. Because of
- // PTOS turns out to be spurious, ACK delay is included.
- EXPECT_EQ(sent_time + expected_pto_delay, manager_.GetRetransmissionTime());
-
- // Received ACK for packets 4.
- ExpectAck(4);
- manager_.OnAckFrameStart(QuicPacketNumber(4), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(4), QuicPacketNumber(5));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(4),
- ENCRYPTION_FORWARD_SECURE));
- EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime());
- // Send more packets, such that peer will do ack decimation.
- std::vector<uint64_t> acked2;
- for (size_t i = 5; i <= 100; ++i) {
- SendDataPacket(i, ENCRYPTION_FORWARD_SECURE);
- acked2.push_back(i);
- }
- // Received ACK for all sent packets.
- ExpectAcksAndLosses(true, &acked2[0], acked2.size(), nullptr, 0);
- manager_.OnAckFrameStart(QuicPacketNumber(100), QuicTime::Delta::Infinite(),
- clock_.Now());
- manager_.OnAckRange(QuicPacketNumber(5), QuicPacketNumber(101));
- EXPECT_EQ(PACKETS_NEWLY_ACKED,
- manager_.OnAckFrameEnd(clock_.Now(), QuicPacketNumber(100),
- ENCRYPTION_FORWARD_SECURE));
-
- expected_pto_delay =
- rtt_stats->SmoothedOrInitialRtt() +
- std::max(GetPtoRttvarMultiplier() * rtt_stats->mean_deviation(),
- QuicTime::Delta::FromMilliseconds(1)) +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- for (size_t i = 101; i < 110; i++) {
- SendDataPacket(i, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO timeout includes ACK delay as there are less than 10 packets
- // outstanding.
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
- }
- expected_pto_delay = expected_pto_delay - QuicTime::Delta::FromMilliseconds(
- kDefaultDelayedAckTimeMs);
- SendDataPacket(110, ENCRYPTION_FORWARD_SECURE);
- // Verify ACK delay is excluded.
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-}
-
-TEST_F(QuicSentPacketManagerTest, StartExponentialBackoffSince2ndPto) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EnablePto(k2PTO);
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPEB2);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
-
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
-
- SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
- QuicTime packet1_sent_time = clock_.Now();
- // Verify PTO is correctly set.
- QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- EXPECT_EQ(packet1_sent_time + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
- SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set based on sent time of packet 2.
- QuicTime deadline = clock_.Now() + expected_pto_delay;
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- // Verify PTO is set based on left edge.
- deadline = packet1_sent_time + expected_pto_delay;
- }
- EXPECT_EQ(deadline, manager_.GetRetransmissionTime());
- EXPECT_EQ(0u, stats_.pto_count);
-
- // Invoke PTO.
- clock_.AdvanceTime(deadline - clock_.Now());
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(1u, stats_.pto_count);
-
- // Verify two probe packets get sent.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(4, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- // Verify no exponential backoff.
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- // Invoke 2nd PTO.
- clock_.AdvanceTime(expected_pto_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(2u, stats_.pto_count);
-
- // Verify two probe packets get sent.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(5, type, ENCRYPTION_FORWARD_SECURE);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(6, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- // Verify still no exponential backoff.
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- // Invoke 3rd PTO.
- clock_.AdvanceTime(expected_pto_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(3u, stats_.pto_count);
-
- // Verify two probe packets get sent.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(7, type, ENCRYPTION_FORWARD_SECURE);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(8, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- // Verify exponential backoff starts.
- EXPECT_EQ(clock_.Now() + expected_pto_delay * 2,
- manager_.GetRetransmissionTime());
-
- // Invoke 4th PTO.
- clock_.AdvanceTime(expected_pto_delay * 2);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(4u, stats_.pto_count);
-
- // Verify two probe packets get sent.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .Times(2)
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(9, type, ENCRYPTION_FORWARD_SECURE);
- })))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(10, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- // Verify exponential backoff continues.
- EXPECT_EQ(clock_.Now() + expected_pto_delay * 4,
- manager_.GetRetransmissionTime());
-}
-
TEST_F(QuicSentPacketManagerTest, PtoTimeoutRttVarMultiple) {
- EnablePto(k1PTO);
- // Use 2 * rttvar
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPVS1);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
-
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -3158,172 +1990,12 @@
SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
// Verify PTO is correctly set based on 2 times rtt var.
QuicTime::Delta expected_pto_delay =
- srtt + 2 * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
EXPECT_EQ(clock_.Now() + expected_pto_delay,
manager_.GetRetransmissionTime());
}
-// Regression test for b/143962153
-TEST_F(QuicSentPacketManagerTest, RtoNotInFlightPacket) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
- // Send SHLO.
- QuicStreamFrame crypto_frame(1, false, 0, absl::string_view());
- SendCryptoPacket(1);
- // Send data packet.
- SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
-
- // Successfully decrypt a forward secure packet.
- EXPECT_CALL(notifier_, OnFrameAcked(_, _, _)).Times(1);
- manager_.SetHandshakeConfirmed();
-
- // 1st TLP.
- manager_.OnRetransmissionTimeout();
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeRetransmitTailLossProbe();
-
- // 2nd TLP.
- manager_.OnRetransmissionTimeout();
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(4, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeRetransmitTailLossProbe();
-
- // RTO retransmits SHLO although it is not in flight.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<0>(Invoke([&crypto_frame](const QuicFrames& frames) {
- EXPECT_EQ(1u, frames.size());
- EXPECT_NE(crypto_frame, frames[0].stream_frame);
- return true;
- })));
- manager_.OnRetransmissionTimeout();
-}
-
-TEST_F(QuicSentPacketManagerTest, Aggressive1Pto) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EnablePto(k1PTO);
- // Let the first PTO be aggressive.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPAG1);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
-
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
- SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set.
- QuicTime::Delta expected_pto_delay = 2 * srtt;
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- // Invoke PTO.
- clock_.AdvanceTime(expected_pto_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(1u, stats_.pto_count);
-
- // Verify 1 probe packets get sent and packet number gets skipped.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
-
- // Verify PTO period gets set correctly.
- QuicTime sent_time = clock_.Now();
- expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- EXPECT_EQ(sent_time + expected_pto_delay * 2,
- manager_.GetRetransmissionTime());
-}
-
-TEST_F(QuicSentPacketManagerTest, Aggressive2Ptos) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EnablePto(k1PTO);
- // Let the first PTO be aggressive.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPAG2);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
-
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
- SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set.
- QuicTime::Delta expected_pto_delay = 2 * srtt;
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- // Invoke PTO.
- clock_.AdvanceTime(expected_pto_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(1u, stats_.pto_count);
-
- // Verify 1 probe packets get sent and packet number gets skipped.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
-
- // Verify PTO period gets set correctly.
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-
- // Invoke 2nd PTO.
- clock_.AdvanceTime(expected_pto_delay);
- manager_.OnRetransmissionTimeout();
- EXPECT_EQ(QuicTime::Delta::Zero(), manager_.TimeUntilSend(clock_.Now()));
- EXPECT_EQ(2u, stats_.pto_count);
-
- // Verify 1 probe packets get sent and packet number gets skipped.
- EXPECT_CALL(notifier_, RetransmitFrames(_, _))
- .WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
- return RetransmitDataPacket(5, type, ENCRYPTION_FORWARD_SECURE);
- })));
- manager_.MaybeSendProbePackets();
- expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
-
- // Verify PTO period gets set correctly.
- EXPECT_EQ(clock_.Now() + expected_pto_delay * 4,
- manager_.GetRetransmissionTime());
-}
-
TEST_F(QuicSentPacketManagerTest, IW10ForUpAndDown) {
QuicConfig config;
QuicTagVector options;
@@ -3339,7 +2011,6 @@
TEST_F(QuicSentPacketManagerTest, ClientMultiplePacketNumberSpacePtoTimeout) {
manager_.EnableMultiplePacketNumberSpacesSupport();
- EnablePto(k1PTO);
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -3354,7 +2025,7 @@
SendDataPacket(1, ENCRYPTION_INITIAL);
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
EXPECT_EQ(clock_.Now() + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3381,7 +2052,7 @@
.WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_HANDSHAKE);
})));
- manager_.MaybeSendProbePackets();
+ manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value.
const QuicTime packet3_sent_time = clock_.Now();
EXPECT_EQ(packet3_sent_time + expected_pto_delay * 2,
@@ -3417,7 +2088,7 @@
SendDataPacket(7, ENCRYPTION_HANDSHAKE);
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation();
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation();
// Verify PTO timeout is now based on packet 7.
EXPECT_EQ(packet7_sent_time + expected_pto_delay * 2,
manager_.GetRetransmissionTime());
@@ -3427,7 +2098,7 @@
// Forward progress has been made, verify PTO counter gets reset. PTO timeout
// is armed by left edge.
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
EXPECT_EQ(packet4_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3435,7 +2106,6 @@
TEST_F(QuicSentPacketManagerTest, ServerMultiplePacketNumberSpacePtoTimeout) {
manager_.EnableMultiplePacketNumberSpacesSupport();
- EnablePto(k1PTO);
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -3450,7 +2120,7 @@
const QuicTime packet1_sent_time = clock_.Now();
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3485,7 +2155,7 @@
// Discard handshake keys.
manager_.SetHandshakeConfirmed();
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
// Verify PTO timeout is now based on packet 3 as handshake is
// complete/confirmed.
@@ -3494,17 +2164,6 @@
}
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutByLeftEdge) {
- EnablePto(k1PTO);
- // Use PTOS and PLE1.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPLE1);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
@@ -3518,7 +2177,7 @@
SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
const QuicTime packet1_sent_time = clock_.Now();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
@@ -3541,7 +2200,7 @@
.WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
})));
- manager_.MaybeSendProbePackets();
+ manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the current value and based on packet3.
QuicTime packet3_sent_time = clock_.Now();
EXPECT_EQ(packet3_sent_time + expected_pto_delay * 2,
@@ -3558,7 +2217,7 @@
ENCRYPTION_FORWARD_SECURE));
expected_pto_delay =
rtt_stats->SmoothedOrInitialRtt() +
- std::max(GetPtoRttvarMultiplier() * rtt_stats->mean_deviation(),
+ std::max(kPtoRttvarMultiplier * rtt_stats->mean_deviation(),
QuicTime::Delta::FromMilliseconds(1)) +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
@@ -3568,17 +2227,6 @@
}
TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutByLeftEdge2) {
- EnablePto(k1PTO);
- // Use PTOS and PLE2.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPLE2);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
@@ -3592,7 +2240,7 @@
SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
const QuicTime packet1_sent_time = clock_.Now();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
@@ -3603,7 +2251,7 @@
expected_pto_delay.ToMilliseconds() - 10));
SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
// Verify PTO expands to packet 2 sent time + 1.5 * srtt.
- expected_pto_delay = 1.5 * rtt_stats->smoothed_rtt();
+ expected_pto_delay = kFirstPtoSrttMultiplier * rtt_stats->smoothed_rtt();
EXPECT_EQ(clock_.Now() + expected_pto_delay,
manager_.GetRetransmissionTime());
EXPECT_EQ(0u, stats_.pto_count);
@@ -3618,11 +2266,11 @@
.WillOnce(WithArgs<1>(Invoke([this](TransmissionType type) {
return RetransmitDataPacket(3, type, ENCRYPTION_FORWARD_SECURE);
})));
- manager_.MaybeSendProbePackets();
+ manager_.MaybeSendProbePacket();
// Verify PTO period gets set to twice the expected value and based on
// packet3 (right edge).
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
QuicTime packet3_sent_time = clock_.Now();
EXPECT_EQ(packet3_sent_time + expected_pto_delay * 2,
@@ -3639,7 +2287,7 @@
ENCRYPTION_FORWARD_SECURE));
expected_pto_delay =
rtt_stats->SmoothedOrInitialRtt() +
- std::max(GetPtoRttvarMultiplier() * rtt_stats->mean_deviation(),
+ std::max(kPtoRttvarMultiplier * rtt_stats->mean_deviation(),
QuicTime::Delta::FromMilliseconds(1)) +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
@@ -3649,61 +2297,9 @@
manager_.GetRetransmissionTime());
}
-TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutUsingStandardDeviation) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- EnablePto(k1PTO);
- // Use PTOS and PSDA.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPSDA);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(75),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
-
- SendDataPacket(1, ENCRYPTION_FORWARD_SECURE);
- // Verify PTO is correctly set using standard deviation.
- QuicTime::Delta expected_pto_delay =
- srtt +
- GetPtoRttvarMultiplier() * rtt_stats->GetStandardOrMeanDeviation() +
- QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
- EXPECT_EQ(clock_.Now() + expected_pto_delay,
- manager_.GetRetransmissionTime());
-}
-
TEST_F(QuicSentPacketManagerTest,
ComputingProbeTimeoutByLeftEdgeMultiplePacketNumberSpaces) {
manager_.EnableMultiplePacketNumberSpacesSupport();
- EnablePto(k1PTO);
- // Use PTOS and PLE1.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPLE1);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
@@ -3719,7 +2315,7 @@
const QuicTime packet1_sent_time = clock_.Now();
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3756,7 +2352,7 @@
// Verify PTO timeout is now based on packet 3 as handshake is
// complete/confirmed.
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
EXPECT_EQ(packet3_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3771,17 +2367,6 @@
TEST_F(QuicSentPacketManagerTest,
ComputingProbeTimeoutByLeftEdge2MultiplePacketNumberSpaces) {
manager_.EnableMultiplePacketNumberSpacesSupport();
- EnablePto(k1PTO);
- // Use PTOS and PLE2.
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kPTOS);
- options.push_back(kPLE2);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
- EXPECT_TRUE(manager_.skip_packet_number_for_pto());
EXPECT_CALL(*send_algorithm_, CanSend(_)).WillRepeatedly(Return(true));
EXPECT_CALL(*send_algorithm_, PacingRate(_))
.WillRepeatedly(Return(QuicBandwidth::Zero()));
@@ -3797,7 +2382,7 @@
const QuicTime packet1_sent_time = clock_.Now();
// Verify PTO is correctly set.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3834,7 +2419,7 @@
// Verify PTO timeout is now based on packet 3 as handshake is
// complete/confirmed.
expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
EXPECT_EQ(packet3_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -3844,7 +2429,7 @@
expected_pto_delay.ToMilliseconds() - 10));
SendDataPacket(5, ENCRYPTION_FORWARD_SECURE);
// Verify PTO timeout expands to packet 5 sent time + 1.5 * srtt.
- EXPECT_EQ(clock_.Now() + 1.5 * rtt_stats->smoothed_rtt(),
+ EXPECT_EQ(clock_.Now() + kFirstPtoSrttMultiplier * rtt_stats->smoothed_rtt(),
manager_.GetRetransmissionTime());
}
@@ -3908,56 +2493,7 @@
QuicSentPacketManagerPeer::UsePacketThresholdForRuntPackets(&manager_));
}
-TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayNonPto) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
- // Before RTT sample is available.
- // 2 TLPs + 2 RTOs.
- QuicTime::Delta expected_delay = QuicTime::Delta::Zero();
- for (size_t i = 0; i < 2; ++i) {
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, i);
- expected_delay =
- expected_delay +
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_);
- }
- for (size_t i = 0; i < 2; ++i) {
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(&manager_, i);
- expected_delay =
- expected_delay +
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_);
- }
- EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
-
- expected_delay = QuicTime::Delta::Zero();
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, 0);
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(&manager_, 0);
-
- // After RTT sample is available.
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(), QuicTime::Zero());
- // 2 TLPs + 2 RTOs.
- for (size_t i = 0; i < 2; ++i) {
- QuicSentPacketManagerPeer::SetConsecutiveTlpCount(&manager_, i);
- expected_delay =
- expected_delay +
- QuicSentPacketManagerPeer::GetTailLossProbeDelay(&manager_);
- }
- for (size_t i = 0; i < 2; ++i) {
- QuicSentPacketManagerPeer::SetConsecutiveRtoCount(&manager_, i);
- expected_delay =
- expected_delay +
- QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_);
- }
- EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
-}
-
TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayDefaultPTO) {
- if (!GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
QuicTime::Delta expected_delay = 4 * manager_.GetPtoDelay();
EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
@@ -3965,34 +2501,26 @@
TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayUsing2PTO) {
QuicConfig client_config;
- QuicTagVector options;
- options.push_back(k1PTO);
QuicTagVector client_options;
client_options.push_back(kPDP2);
QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
client_config.SetClientConnectionOptions(client_options);
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
manager_.SetFromConfig(client_config);
- EXPECT_TRUE(manager_.pto_enabled());
QuicTime::Delta expected_delay = 2 * manager_.GetPtoDelay();
EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
}
TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayUsing1PTO) {
QuicConfig client_config;
- QuicTagVector options;
- options.push_back(k1PTO);
QuicTagVector client_options;
client_options.push_back(kPDP1);
QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
- client_config.SetConnectionOptionsToSend(options);
client_config.SetClientConnectionOptions(client_options);
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
manager_.SetFromConfig(client_config);
- EXPECT_TRUE(manager_.pto_enabled());
QuicTime::Delta expected_delay = 1 * manager_.GetPtoDelay();
EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
}
@@ -4068,10 +2596,7 @@
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
.WillOnce(
WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); })));
- manager_.MaybeSendProbePackets();
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- manager_.AdjustPendingTimerTransmissions();
- }
+ manager_.MaybeSendProbePacket();
// Verify exponential backoff of the PTO timeout.
EXPECT_EQ(clock_.Now() + 2 * expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -4098,10 +2623,7 @@
EXPECT_CALL(notifier_, RetransmitFrames(_, _))
.WillOnce(
WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); })));
- manager_.MaybeSendProbePackets();
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- manager_.AdjustPendingTimerTransmissions();
- }
+ manager_.MaybeSendProbePacket();
// Verify exponential backoff of the PTO timeout.
EXPECT_EQ(clock_.Now() + 2 * expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -4135,7 +2657,7 @@
// Verify nothing to probe (and connection will send PING for current
// encryption level).
EXPECT_CALL(notifier_, RetransmitFrames(_, _)).Times(0);
- manager_.MaybeSendProbePackets();
+ manager_.MaybeSendProbePacket();
}
// Regression test for b/156487311
@@ -4171,7 +2693,7 @@
RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
const QuicTime::Delta pto_delay =
rtt_stats->smoothed_rtt() +
- GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
// Verify PTO is armed based on handshake data.
EXPECT_EQ(packet2_sent_time + pto_delay, manager_.GetRetransmissionTime());
@@ -4246,7 +2768,7 @@
SendDataPacket(3, ENCRYPTION_HANDSHAKE);
// Verify PTO is correctly set based on packet 1.
QuicTime::Delta expected_pto_delay =
- srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() +
+ srtt + kPtoRttvarMultiplier * rtt_stats->mean_deviation() +
QuicTime::Delta::Zero();
EXPECT_EQ(packet1_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
@@ -4274,33 +2796,6 @@
manager_.GetRetransmissionTime());
}
-TEST_F(QuicSentPacketManagerTest,
- AggressivePtoBeforeAnyRttSamplesAreAvailable) {
- if (GetQuicRestartFlag(quic_default_on_pto2)) {
- return;
- }
- manager_.EnableMultiplePacketNumberSpacesSupport();
- EXPECT_CALL(*send_algorithm_, PacingRate(_))
- .WillRepeatedly(Return(QuicBandwidth::Zero()));
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
- .WillRepeatedly(Return(10 * kDefaultTCPMSS));
- RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats());
-
- QuicConfig config;
- QuicTagVector options;
- options.push_back(kAPTO);
- QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
- EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
- EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
- manager_.SetFromConfig(config);
-
- // Send INITIAL 1.
- SendDataPacket(1, ENCRYPTION_INITIAL);
- // Verify retransmission timeout is expected.
- EXPECT_EQ(clock_.Now() + 1.5 * rtt_stats->initial_rtt(),
- manager_.GetRetransmissionTime());
-}
-
TEST_F(QuicSentPacketManagerTest, SendPathChallengeAndGetAck) {
QuicPacketNumber packet_number(1);
EXPECT_CALL(*send_algorithm_,
diff --git a/quiche/quic/core/quic_session_test.cc b/quiche/quic/core/quic_session_test.cc
index ccaa29d..bb198e4 100644
--- a/quiche/quic/core/quic_session_test.cc
+++ b/quiche/quic/core/quic_session_test.cc
@@ -2488,7 +2488,7 @@
EXPECT_CALL(*stream6, RetransmitStreamData(_, _, _, _))
.WillOnce(Return(true));
EXPECT_CALL(*send_algorithm, OnApplicationLimited(_));
- session_.RetransmitFrames(frames, TLP_RETRANSMISSION);
+ session_.RetransmitFrames(frames, PTO_RETRANSMISSION);
}
// Regression test of b/110082001.
diff --git a/quiche/quic/core/quic_stream.cc b/quiche/quic/core/quic_stream.cc
index 7d1a9dd..90b1e29 100644
--- a/quiche/quic/core/quic_stream.cc
+++ b/quiche/quic/core/quic_stream.cc
@@ -1139,8 +1139,7 @@
bool QuicStream::RetransmitStreamData(QuicStreamOffset offset,
QuicByteCount data_length, bool fin,
TransmissionType type) {
- QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
- type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
+ QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == PROBING_RETRANSMISSION);
if (HasDeadlinePassed()) {
OnDeadlinePassed();
return true;
diff --git a/quiche/quic/core/quic_types.cc b/quiche/quic/core/quic_types.cc
index 389477b..3d52661 100644
--- a/quiche/quic/core/quic_types.cc
+++ b/quiche/quic/core/quic_types.cc
@@ -214,8 +214,6 @@
RETURN_STRING_LITERAL(HANDSHAKE_RETRANSMISSION);
RETURN_STRING_LITERAL(ALL_ZERO_RTT_RETRANSMISSION);
RETURN_STRING_LITERAL(LOSS_RETRANSMISSION);
- RETURN_STRING_LITERAL(RTO_RETRANSMISSION);
- RETURN_STRING_LITERAL(TLP_RETRANSMISSION);
RETURN_STRING_LITERAL(PTO_RETRANSMISSION);
RETURN_STRING_LITERAL(PROBING_RETRANSMISSION);
RETURN_STRING_LITERAL(PATH_RETRANSMISSION);
diff --git a/quiche/quic/core/quic_types.h b/quiche/quic/core/quic_types.h
index b136708..c21030b 100644
--- a/quiche/quic/core/quic_types.h
+++ b/quiche/quic/core/quic_types.h
@@ -187,8 +187,6 @@
ALL_ZERO_RTT_RETRANSMISSION, // Retransmits all packets encrypted with 0-RTT
// key.
LOSS_RETRANSMISSION, // Retransmits due to loss detection.
- RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
- TLP_RETRANSMISSION, // Tail loss probes.
PTO_RETRANSMISSION, // Retransmission due to probe timeout.
PROBING_RETRANSMISSION, // Retransmission in order to probe bandwidth.
PATH_RETRANSMISSION, // Retransmission proactively due to underlying
@@ -552,10 +550,6 @@
HANDSHAKE_RETRANSMITTED,
// This packet is considered as lost, this is used for LOST_RETRANSMISSION.
LOST,
- // This packet has been retransmitted when TLP fires.
- TLP_RETRANSMITTED,
- // This packet has been retransmitted when RTO fires.
- RTO_RETRANSMITTED,
// This packet has been retransmitted when PTO fires.
PTO_RETRANSMITTED,
// This packet has been retransmitted for probing purpose.
diff --git a/quiche/quic/core/quic_unacked_packet_map_test.cc b/quiche/quic/core/quic_unacked_packet_map_test.cc
index 3acb13a..0540164 100644
--- a/quiche/quic/core/quic_unacked_packet_map_test.cc
+++ b/quiche/quic/core/quic_unacked_packet_map_test.cc
@@ -402,8 +402,8 @@
std::vector<uint64_t> retransmittable2 = {1, 3};
VerifyRetransmittablePackets(&retransmittable2[0], retransmittable2.size());
- // TLP 3 (formerly 1) as 4, and don't remove 1 from unacked.
- RetransmitAndSendPacket(3, 4, TLP_RETRANSMISSION);
+ // PTO 3 (formerly 1) as 4, and don't remove 1 from unacked.
+ RetransmitAndSendPacket(3, 4, PTO_RETRANSMISSION);
SerializedPacket packet5(CreateRetransmittablePacket(5));
unacked_packets_.AddSentPacket(&packet5, NOT_RETRANSMISSION, now_, true,
true);
diff --git a/quiche/quic/core/quic_utils.cc b/quiche/quic/core/quic_utils.cc
index fcda2e6..6113c91 100644
--- a/quiche/quic/core/quic_utils.cc
+++ b/quiche/quic/core/quic_utils.cc
@@ -170,8 +170,6 @@
RETURN_STRING_LITERAL(NEUTERED);
RETURN_STRING_LITERAL(HANDSHAKE_RETRANSMITTED);
RETURN_STRING_LITERAL(LOST);
- RETURN_STRING_LITERAL(TLP_RETRANSMITTED);
- RETURN_STRING_LITERAL(RTO_RETRANSMITTED);
RETURN_STRING_LITERAL(PTO_RETRANSMITTED);
RETURN_STRING_LITERAL(PROBE_RETRANSMITTED);
RETURN_STRING_LITERAL(NOT_CONTRIBUTING_RTT);
@@ -289,10 +287,6 @@
return HANDSHAKE_RETRANSMITTED;
case LOSS_RETRANSMISSION:
return LOST;
- case TLP_RETRANSMISSION:
- return TLP_RETRANSMITTED;
- case RTO_RETRANSMISSION:
- return RTO_RETRANSMITTED;
case PTO_RETRANSMISSION:
return PTO_RETRANSMITTED;
case PROBING_RETRANSMISSION:
diff --git a/quiche/quic/core/quic_utils_test.cc b/quiche/quic/core/quic_utils_test.cc
index 19ce446..a985b37 100644
--- a/quiche/quic/core/quic_utils_test.cc
+++ b/quiche/quic/core/quic_utils_test.cc
@@ -129,10 +129,6 @@
EXPECT_EQ(LOST, state);
} else if (i == ALL_ZERO_RTT_RETRANSMISSION) {
EXPECT_EQ(UNACKABLE, state);
- } else if (i == TLP_RETRANSMISSION) {
- EXPECT_EQ(TLP_RETRANSMITTED, state);
- } else if (i == RTO_RETRANSMISSION) {
- EXPECT_EQ(RTO_RETRANSMITTED, state);
} else if (i == PTO_RETRANSMISSION) {
EXPECT_EQ(PTO_RETRANSMITTED, state);
} else if (i == PROBING_RETRANSMISSION) {