gfe-relnote: Change QuicSentPacketManager::SetSendAlgorithm(CongestionControlType) to a no-op if the current and the requested cc_type are the same. Protected by --gfe2_reloadable_flag_quic_set_send_algorithm_noop_if_cc_type_unchanged.
PiperOrigin-RevId: 292011155
Change-Id: Ibac886fb3ebf97c4c54405d462e2c0a4ea1f41ac
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 9246499..302daf4 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -1121,6 +1121,18 @@
void QuicSentPacketManager::SetSendAlgorithm(
CongestionControlType congestion_control_type) {
+ if (GetQuicReloadableFlag(
+ quic_set_send_algorithm_noop_if_cc_type_unchanged)) {
+ if (send_algorithm_ && send_algorithm_->GetCongestionControlType() ==
+ congestion_control_type) {
+ QUIC_RELOADABLE_FLAG_COUNT_N(
+ quic_set_send_algorithm_noop_if_cc_type_unchanged, 1, 2);
+ return;
+ }
+ QUIC_RELOADABLE_FLAG_COUNT_N(
+ quic_set_send_algorithm_noop_if_cc_type_unchanged, 2, 2);
+ // Fallthrough to change the send algorithm.
+ }
SetSendAlgorithm(SendAlgorithmInterface::Create(
clock_, &rtt_stats_, &unacked_packets_, congestion_control_type, random_,
stats_, initial_congestion_window_));
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index 247c03f..c677afa 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -85,12 +85,13 @@
}
protected:
+ const CongestionControlType kInitialCongestionControlType = kCubicBytes;
QuicSentPacketManagerTest()
: manager_(Perspective::IS_SERVER,
&clock_,
QuicRandom::GetInstance(),
&stats_,
- kCubicBytes,
+ kInitialCongestionControlType,
GetDefaultLossDetectionType()),
send_algorithm_(new StrictMock<MockSendAlgorithm>),
network_change_visitor_(new StrictMock<MockNetworkChangeVisitor>) {
@@ -102,6 +103,8 @@
manager_.SetNetworkChangeVisitor(network_change_visitor_.get());
manager_.SetSessionNotifier(¬ifier_);
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType())
+ .WillRepeatedly(Return(kInitialCongestionControlType));
EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate())
.Times(AnyNumber());
EXPECT_CALL(*send_algorithm_, BandwidthEstimate())