Internal change PiperOrigin-RevId: 424125792
diff --git a/quic/core/congestion_control/pacing_sender.h b/quic/core/congestion_control/pacing_sender.h index d473a38..b2401a2 100644 --- a/quic/core/congestion_control/pacing_sender.h +++ b/quic/core/congestion_control/pacing_sender.h
@@ -79,6 +79,8 @@ return {ideal_next_packet_send_time_, allow_burst}; } + uint32_t initial_burst_size() const { return initial_burst_size_; } + protected: uint32_t lumpy_tokens() const { return lumpy_tokens_; }
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h index 2fa1217..4271603 100644 --- a/quic/core/congestion_control/send_algorithm_interface.h +++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -33,27 +33,28 @@ public: // Network Params for AdjustNetworkParameters. struct QUIC_NO_EXPORT NetworkParams { - NetworkParams() - : NetworkParams(QuicBandwidth::Zero(), QuicTime::Delta::Zero(), false) { - } + NetworkParams() = default; NetworkParams(const QuicBandwidth& bandwidth, const QuicTime::Delta& rtt, bool allow_cwnd_to_decrease) : bandwidth(bandwidth), rtt(rtt), allow_cwnd_to_decrease(allow_cwnd_to_decrease) {} + explicit NetworkParams(int burst_token) : burst_token(burst_token) {} bool operator==(const NetworkParams& other) const { return bandwidth == other.bandwidth && rtt == other.rtt && max_initial_congestion_window == other.max_initial_congestion_window && + burst_token == other.burst_token && allow_cwnd_to_decrease == other.allow_cwnd_to_decrease; } - QuicBandwidth bandwidth; - QuicTime::Delta rtt; + QuicBandwidth bandwidth = QuicBandwidth::Zero(); + QuicTime::Delta rtt = QuicTime::Delta::Zero(); int max_initial_congestion_window = 0; - bool allow_cwnd_to_decrease; + int burst_token = 0; + bool allow_cwnd_to_decrease = false; }; static SendAlgorithmInterface* Create(
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h index a700fd7..471ecd1 100644 --- a/quic/core/quic_flags_list.h +++ b/quic/core/quic_flags_list.h
@@ -6,6 +6,8 @@ #ifdef QUIC_FLAG +QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_set_burst_token, false) + QUIC_FLAG(FLAGS_quic_restart_flag_quic_offload_pacing_to_usps2, false) // A testonly reloadable flag that will always default to false. QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_testonly_default_false, false)
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index 4c5026c..eae919c 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -392,6 +392,18 @@ void QuicSentPacketManager::AdjustNetworkParameters( const SendAlgorithmInterface::NetworkParams& params) { + if (params.burst_token != 0) { + if (using_pacing_) { + QUIC_RELOADABLE_FLAG_COUNT(quic_set_burst_token); + int old_burst_size = pacing_sender_.initial_burst_size(); + pacing_sender_.SetBurstTokens(params.burst_token); + if (debug_delegate_ != nullptr) { + debug_delegate_->OnAdjustBurstSize(old_burst_size, + pacing_sender_.initial_burst_size()); + } + } + return; + } const QuicBandwidth& bandwidth = params.bandwidth; const QuicTime::Delta& rtt = params.rtt; if (!rtt.IsZero()) {
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h index e4a7036..b1efb81 100644 --- a/quic/core/quic_sent_packet_manager.h +++ b/quic/core/quic_sent_packet_manager.h
@@ -80,6 +80,9 @@ QuicByteCount /*old_cwnd*/, QuicByteCount /*new_cwnd*/) {} + virtual void OnAdjustBurstSize(int /*old_burst_size*/, + int /*new_burst_size*/) {} + virtual void OnOvershootingDetected() {} };
diff --git a/quic/test_tools/quic_sent_packet_manager_peer.cc b/quic/test_tools/quic_sent_packet_manager_peer.cc index 7d1ba86..3223516 100644 --- a/quic/test_tools/quic_sent_packet_manager_peer.cc +++ b/quic/test_tools/quic_sent_packet_manager_peer.cc
@@ -180,6 +180,12 @@ } // static +int QuicSentPacketManagerPeer::GetPacerInitialBurstSize( + QuicSentPacketManager* sent_packet_manager) { + return sent_packet_manager->pacing_sender_.initial_burst_size_; +} + +// static void QuicSentPacketManagerPeer::SetNextPacedPacketTime( QuicSentPacketManager* sent_packet_manager, QuicTime time) {
diff --git a/quic/test_tools/quic_sent_packet_manager_peer.h b/quic/test_tools/quic_sent_packet_manager_peer.h index a39915f..35c5897 100644 --- a/quic/test_tools/quic_sent_packet_manager_peer.h +++ b/quic/test_tools/quic_sent_packet_manager_peer.h
@@ -85,6 +85,9 @@ static void DisablePacerBursts(QuicSentPacketManager* sent_packet_manager); + static int GetPacerInitialBurstSize( + QuicSentPacketManager* sent_packet_manager); + static void SetNextPacedPacketTime(QuicSentPacketManager* sent_packet_manager, QuicTime time);