Add connection option to trigger path degrading on 1 PTO.
PiperOrigin-RevId: 407469396
diff --git a/quic/core/crypto/crypto_protocol.h b/quic/core/crypto/crypto_protocol.h
index f0a20cc..b2776be 100644
--- a/quic/core/crypto/crypto_protocol.h
+++ b/quic/core/crypto/crypto_protocol.h
@@ -401,6 +401,9 @@
const QuicTag kQLVE = TAG('Q', 'L', 'V', 'E'); // Legacy Version
// Encapsulation.
+const QuicTag kPDP1 = TAG('P', 'D', 'P', '1'); // Path degrading triggered
+ // at 1PTO.
+
const QuicTag kPDP2 = TAG('P', 'D', 'P', '2'); // Path degrading triggered
// at 2PTO.
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index b7c3a5b..4c5026c 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -226,6 +226,9 @@
use_standard_deviation_for_pto_ = true;
rtt_stats_.EnableStandardDeviationCalculation();
}
+ if (config.HasClientRequestedIndependentOption(kPDP1, perspective)) {
+ num_ptos_for_path_degrading_ = 1;
+ }
if (config.HasClientRequestedIndependentOption(kPDP2, perspective)) {
num_ptos_for_path_degrading_ = 2;
}
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index 99865a0..a09afc6 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -4041,7 +4041,7 @@
EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
}
-TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayUsingPTO) {
+TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayUsing2PTO) {
QuicConfig client_config;
QuicTagVector options;
options.push_back(k1PTO);
@@ -4058,6 +4058,23 @@
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());
+}
+
TEST_F(QuicSentPacketManagerTest, ClientsIgnorePings) {
QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
QuicConfig client_config;