Default enable PTO with configuration: 1) Send 1 packet per PTO with skipped packet number. 2) Arm the 1st PTO based on the earliest in flight sent time while making sure at least 1.5 * srtt has passed since the last in flight packet. 3) PTO delay = srtt + 2 * rttvar + ack_delay. Please note, this should only affect gQUIC while IETF QUIC has been using PTO with this configuration. Also cleanup experiment connection options: 2PTO, 1PTO, PTOS, PTOA, PEB1, PEB2, PVS1, PAG1, PAG2, PLE1, PLE2, APTO, PSDA. Protected by FLAGS_quic_restart_flag_quic_default_on_pto2. PiperOrigin-RevId: 431699930
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc index f55138b..1162de1 100644 --- a/quic/core/quic_connection_test.cc +++ b/quic/core/quic_connection_test.cc
@@ -493,10 +493,9 @@ bool PtoEnabled() { if (QuicConnectionPeer::GetSentPacketManager(this)->pto_enabled()) { - // PTO mode is default enabled for T099. And TLP/RTO related tests are - // stale. + // TLP/RTO related tests are stale when PTO is enabled. QUICHE_DCHECK(PROTOCOL_TLS1_3 == version().handshake_protocol || - GetQuicReloadableFlag(quic_default_on_pto)); + GetQuicRestartFlag(quic_default_on_pto2)); return true; } return false; @@ -4025,8 +4024,7 @@ // Fire the RTO and verify that the RST_STREAM is resent, the stream data // is sent. - const size_t num_retransmissions = - connection_.SupportsMultiplePacketNumberSpaces() ? 1 : 2; + const size_t num_retransmissions = connection_.PtoEnabled() ? 1 : 2; EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) .Times(AtLeast(num_retransmissions)); clock_.AdvanceTime(DefaultRetransmissionTime()); @@ -4255,10 +4253,7 @@ writer_->SetWritable(); connection_.OnCanWrite(); EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet()); - uint64_t retransmission = connection_.SupportsMultiplePacketNumberSpaces() && - !GetQuicReloadableFlag(quic_default_on_pto) - ? 3 - : 2; + uint64_t retransmission = connection_.PtoEnabled() ? 3 : 2; EXPECT_FALSE(QuicConnectionPeer::HasRetransmittableFrames(&connection_, retransmission)); } @@ -9918,12 +9913,7 @@ EXPECT_EQ(0u, connection_.GetStats().crypto_retransmit_count); // PTO fires, verify a PING packet gets sent because there is no data to send. - EXPECT_CALL(*send_algorithm_, - OnPacketSent(_, _, - GetQuicReloadableFlag(quic_default_on_pto) - ? QuicPacketNumber(2) - : QuicPacketNumber(3), - _, _)); + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(3), _, _)); connection_.GetRetransmissionAlarm()->Fire(); EXPECT_EQ(1u, connection_.GetStats().pto_count); EXPECT_EQ(1u, connection_.GetStats().crypto_retransmit_count); @@ -10397,12 +10387,7 @@ // Retransmit handshake data. clock_.AdvanceTime(retransmission_time - clock_.Now()); - EXPECT_CALL(*send_algorithm_, - OnPacketSent(_, _, - GetQuicReloadableFlag(quic_default_on_pto) - ? QuicPacketNumber(3) - : QuicPacketNumber(4), - _, _)); + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(4), _, _)); connection_.GetRetransmissionAlarm()->Fire(); // Verify 1-RTT packet gets coalesced with handshake retransmission. EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet()); @@ -10416,14 +10401,8 @@ // Retransmit handshake data again. clock_.AdvanceTime(retransmission_time - clock_.Now()); - QuicPacketNumber handshake_retransmission = - GetQuicReloadableFlag(quic_default_on_pto) ? QuicPacketNumber(5) - : QuicPacketNumber(7); - handshake_retransmission += 1; - EXPECT_CALL(*send_algorithm_, - OnPacketSent(_, _, handshake_retransmission + 1, _, _)); - EXPECT_CALL(*send_algorithm_, - OnPacketSent(_, _, handshake_retransmission, _, _)); + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(9), _, _)); + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(8), _, _)); connection_.GetRetransmissionAlarm()->Fire(); // Verify 1-RTT packet gets coalesced with handshake retransmission. EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet()); @@ -10435,12 +10414,7 @@ // Retransmit application data. clock_.AdvanceTime(retransmission_time - clock_.Now()); - QuicPacketNumber application_retransmission = - GetQuicReloadableFlag(quic_default_on_pto) ? QuicPacketNumber(6) - : QuicPacketNumber(9); - application_retransmission += 2; - EXPECT_CALL(*send_algorithm_, - OnPacketSent(_, _, application_retransmission, _, _)); + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, QuicPacketNumber(11), _, _)); connection_.GetRetransmissionAlarm()->Fire(); EXPECT_EQ(0x01010101u, writer_->final_bytes_of_last_packet()); } @@ -11436,11 +11410,7 @@ clock_.AdvanceTime(kTestRTT); // Assume retransmitted INITIAL gets received. QuicFrames frames; - QuicPacketNumber initial_retransmission = - GetQuicReloadableFlag(quic_default_on_pto) ? QuicPacketNumber(3) - : QuicPacketNumber(4); - auto ack_frame = - InitAckFrame({{initial_retransmission, initial_retransmission + 1}}); + auto ack_frame = InitAckFrame({{QuicPacketNumber(4), QuicPacketNumber(5)}}); frames.push_back(QuicFrame(&ack_frame)); EXPECT_CALL(*send_algorithm_, OnCongestionEvent(_, _, _, _, _)) .Times(AnyNumber()); @@ -11451,7 +11421,7 @@ // HANDSHAKE 5 is also processed. QuicAckFrame ack_frame2 = InitAckFrame({{QuicPacketNumber(2), QuicPacketNumber(3)}, - {initial_retransmission + 1, initial_retransmission + 2}}); + {QuicPacketNumber(5), QuicPacketNumber(6)}}); ack_frame2.ack_delay_time = QuicTime::Delta::Zero(); frames.push_back(QuicFrame(&ack_frame2)); ProcessFramesPacketAtLevel(1, frames, ENCRYPTION_HANDSHAKE);
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h index 3399f1b..a3605fe 100644 --- a/quic/core/quic_flags_list.h +++ b/quic/core/quic_flags_list.h
@@ -42,7 +42,7 @@ // If true, close read side but not write side in QuicSpdyStream::OnStreamReset(). QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_fix_on_stream_reset, true) // If true, default on PTO which unifies TLP + RTO loss recovery. -QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_default_on_pto, false) +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, delay block allocation in QuicStreamSequencerBuffer until there is actually new data available.
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index ff40ba4..588c3ef 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -68,11 +68,8 @@ : "Client: ") QuicSentPacketManager::QuicSentPacketManager( - Perspective perspective, - const QuicClock* clock, - QuicRandom* random, - QuicConnectionStats* stats, - CongestionControlType congestion_control_type) + Perspective perspective, const QuicClock* clock, QuicRandom* random, + QuicConnectionStats* stats, CongestionControlType congestion_control_type) : unacked_packets_(perspective), clock_(clock), random_(random), @@ -100,7 +97,7 @@ QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs)), rtt_updated_(false), acked_packets_iter_(last_ack_frame_.packets.rbegin()), - pto_enabled_(GetQuicReloadableFlag(quic_default_on_pto)), + pto_enabled_(GetQuicRestartFlag(quic_default_on_pto2)), max_probe_packets_per_pto_(2), consecutive_pto_count_(0), handshake_mode_disabled_(false), @@ -120,9 +117,14 @@ ignore_ack_delay_(false) { SetSendAlgorithm(congestion_control_type); if (pto_enabled_) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_default_on_pto, 1, 2); + QUIC_RESTART_FLAG_COUNT_N(quic_default_on_pto2, 1, 2); // TODO(fayang): change the default values when deprecating - // quic_default_on_pto. + // 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; } @@ -169,57 +171,61 @@ min_rto_timeout_ = kAlarmGranularity; } - 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."; + 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; } - skip_packet_number_for_pto_ = true; + + 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 (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; } @@ -1085,15 +1091,20 @@ void QuicSentPacketManager::EnableIetfPtoAndLossDetection() { if (pto_enabled_) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_default_on_pto, 2, 2); + 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; 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 + // 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;
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc index e561731..d038f4f 100644 --- a/quic/core/quic_sent_packet_manager_test.cc +++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -328,7 +328,7 @@ } int GetPtoRttvarMultiplier() { - if (GetQuicReloadableFlag(quic_default_on_pto) || + if (GetQuicRestartFlag(quic_default_on_pto2) || manager_.handshake_mode_disabled()) { return 2; } @@ -832,7 +832,7 @@ } TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeout) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); @@ -897,7 +897,7 @@ } TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); @@ -1138,7 +1138,7 @@ } TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } StrictMock<MockDebugDelegate> debug_delegate; @@ -1190,7 +1190,7 @@ } TEST_F(QuicSentPacketManagerTest, RetransmissionTimeoutOnePacket) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } // Set the 1RTO connection option. @@ -1228,7 +1228,7 @@ } TEST_F(QuicSentPacketManagerTest, NewRetransmissionTimeout) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig client_config; @@ -1285,7 +1285,7 @@ } TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } // Send 1 packet. @@ -1321,7 +1321,7 @@ } TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } // Send 1 packet. @@ -1449,7 +1449,7 @@ } TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeTailLossProbe) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); @@ -1486,7 +1486,7 @@ } TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeSpuriousRTO) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats()); @@ -1546,7 +1546,7 @@ } TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMin) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } SendDataPacket(1); @@ -1571,7 +1571,7 @@ } TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayMax) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } SendDataPacket(1); @@ -1585,7 +1585,7 @@ } TEST_F(QuicSentPacketManagerTest, GetTransmissionDelayExponentialBackoff) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } SendDataPacket(1); @@ -1605,7 +1605,7 @@ } TEST_F(QuicSentPacketManagerTest, RetransmissionDelay) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } RttStats* rtt_stats = const_cast<RttStats*>(manager_.GetRttStats()); @@ -1869,7 +1869,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoMinTLPFromOptionsAtServer) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig config; @@ -1900,7 +1900,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoMinTLPFromOptionsAtClient) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig client_config; @@ -1931,7 +1931,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoMinRTOFromOptionsAtServer) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig config; @@ -1956,7 +1956,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoMinRTOFromOptionsAtClient) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig client_config; @@ -1982,7 +1982,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig config; @@ -1997,7 +1997,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig client_config; @@ -2013,7 +2013,7 @@ } TEST_F(QuicSentPacketManagerTest, Negotiate1TLPFromOptionsAtServer) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig config; @@ -2028,7 +2028,7 @@ } TEST_F(QuicSentPacketManagerTest, Negotiate1TLPFromOptionsAtClient) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicConfig client_config; @@ -2044,7 +2044,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtServer) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); @@ -2060,7 +2060,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateNewRTOFromOptionsAtClient) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } EXPECT_FALSE(QuicSentPacketManagerPeer::GetUseNewRto(&manager_)); @@ -2623,7 +2623,7 @@ // Regression test for b/133771183. TEST_F(QuicSentPacketManagerTest, PacketInLimbo) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); @@ -2679,7 +2679,7 @@ } TEST_F(QuicSentPacketManagerTest, RtoFiresNoPacketToRetransmit) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } // Send 10 packets. @@ -2731,7 +2731,7 @@ 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 (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { // Verify PTO is set based on left edge. deadline = packet1_sent_time + expected_pto_delay; } @@ -2745,15 +2745,22 @@ EXPECT_EQ(1u, stats_.pto_count); EXPECT_EQ(0u, stats_.max_consecutive_rto_with_forward_progress); - // 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); - }))); + 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(); // Verify PTO period gets set to twice the current value. QuicTime sent_time = clock_.Now(); @@ -2801,7 +2808,7 @@ srtt + GetPtoRttvarMultiplier() * rtt_stats->mean_deviation() + QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs); QuicTime deadline = clock_.Now() + expected_pto_delay; - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { // Verify PTO is set based on left edge. deadline = packet1_sent_time + expected_pto_delay; } @@ -2876,6 +2883,9 @@ } TEST_F(QuicSentPacketManagerTest, PtoTimeoutIncludesMaxAckDelay) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } EnablePto(k1PTO); // Use PTOS and PTOA. QuicConfig config; @@ -2914,7 +2924,7 @@ expected_pto_delay = expected_pto_delay - QuicTime::Delta::FromMilliseconds( kDefaultDelayedAckTimeMs); QuicTime deadline = clock_.Now() + expected_pto_delay; - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { deadline = packet1_sent_time + expected_pto_delay; } EXPECT_EQ(deadline, manager_.GetRetransmissionTime()); @@ -3002,6 +3012,9 @@ } TEST_F(QuicSentPacketManagerTest, StartExponentialBackoffSince2ndPto) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } EnablePto(k2PTO); QuicConfig config; QuicTagVector options; @@ -3033,7 +3046,7 @@ 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 (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { // Verify PTO is set based on left edge. deadline = packet1_sent_time + expected_pto_delay; } @@ -3152,7 +3165,7 @@ // Regression test for b/143962153 TEST_F(QuicSentPacketManagerTest, RtoNotInFlightPacket) { - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { return; } QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); @@ -3193,6 +3206,9 @@ } TEST_F(QuicSentPacketManagerTest, Aggressive1Pto) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } EnablePto(k1PTO); // Let the first PTO be aggressive. QuicConfig config; @@ -3241,6 +3257,9 @@ } TEST_F(QuicSentPacketManagerTest, Aggressive2Ptos) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } EnablePto(k1PTO); // Let the first PTO be aggressive. QuicConfig config; @@ -3630,6 +3649,9 @@ } TEST_F(QuicSentPacketManagerTest, ComputingProbeTimeoutUsingStandardDeviation) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } EnablePto(k1PTO); // Use PTOS and PSDA. QuicConfig config; @@ -4034,7 +4056,7 @@ .WillOnce( WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); }))); manager_.MaybeSendProbePackets(); - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { manager_.AdjustPendingTimerTransmissions(); } // Verify exponential backoff of the PTO timeout. @@ -4064,7 +4086,7 @@ .WillOnce( WithArgs<1>(Invoke([this]() { return RetransmitCryptoPacket(3); }))); manager_.MaybeSendProbePackets(); - if (GetQuicReloadableFlag(quic_default_on_pto)) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { manager_.AdjustPendingTimerTransmissions(); } // Verify exponential backoff of the PTO timeout. @@ -4238,6 +4260,9 @@ TEST_F(QuicSentPacketManagerTest, AggressivePtoBeforeAnyRttSamplesAreAvailable) { + if (GetQuicRestartFlag(quic_default_on_pto2)) { + return; + } manager_.EnableMultiplePacketNumberSpacesSupport(); EXPECT_CALL(*send_algorithm_, PacingRate(_)) .WillRepeatedly(Return(QuicBandwidth::Zero()));