Index: net/quic/congestion_control/pacing_sender.cc |
diff --git a/net/quic/congestion_control/pacing_sender.cc b/net/quic/congestion_control/pacing_sender.cc |
index bbcae0c69a0cec157c1d789143a4f1fe61fe0c6f..c6f33efd5c4307faf24bf40c4b588275aea5f3ea 100644 |
--- a/net/quic/congestion_control/pacing_sender.cc |
+++ b/net/quic/congestion_control/pacing_sender.cc |
@@ -4,6 +4,10 @@ |
#include "net/quic/congestion_control/pacing_sender.h" |
+#include "net/quic/quic_flags.h" |
+ |
+using std::min; |
+ |
namespace net { |
PacingSender::PacingSender(SendAlgorithmInterface* sender, |
@@ -61,8 +65,16 @@ bool PacingSender::OnPacketSent( |
return in_flight; |
} |
if (bytes_in_flight == 0) { |
- // Add more burst tokens anytime the connection is leaving quiescence. |
- burst_tokens_ = initial_packet_burst_; |
+ // Add more burst tokens anytime the connection is leaving quiescence, but |
+ // limit it to the equivalent of a single bulk write, not exceeding the |
+ // current CWND in packets. |
+ if (FLAGS_quic_limit_pacing_burst) { |
+ burst_tokens_ = min( |
+ initial_packet_burst_, |
+ static_cast<uint32>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); |
+ } else { |
+ burst_tokens_ = initial_packet_burst_; |
+ } |
} |
if (burst_tokens_ > 0) { |
--burst_tokens_; |