Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Unified Diff: net/quic/congestion_control/pacing_sender.cc

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/pacing_sender.h ('k') | net/quic/congestion_control/pacing_sender_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 447890b5b5b4622dfaf5cda85ccc8f9224454b12..62c64ea74d68095e86647f89ae89461ecf323c85 100644
--- a/net/quic/congestion_control/pacing_sender.cc
+++ b/net/quic/congestion_control/pacing_sender.cc
@@ -14,7 +14,7 @@ PacingSender::PacingSender(SendAlgorithmInterface* sender,
initial_packet_burst_(initial_packet_burst),
burst_tokens_(initial_packet_burst),
last_delayed_packet_sent_time_(QuicTime::Zero()),
- next_packet_send_time_(QuicTime::Zero()),
+ ideal_next_packet_send_time_(QuicTime::Zero()),
was_last_send_delayed_(false) {
}
@@ -56,11 +56,15 @@ bool PacingSender::OnPacketSent(
if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) {
return in_flight;
}
+ if (bytes_in_flight == 0) {
+ // Add more burst tokens anytime the connection is leaving quiescence.
+ burst_tokens_ = initial_packet_burst_;
+ }
if (burst_tokens_ > 0) {
--burst_tokens_;
was_last_send_delayed_ = false;
last_delayed_packet_sent_time_ = QuicTime::Zero();
- next_packet_send_time_ = QuicTime::Zero();
+ ideal_next_packet_send_time_ = QuicTime::Zero();
return in_flight;
}
// The next packet should be sent as soon as the current packets has been
@@ -69,13 +73,14 @@ bool PacingSender::OnPacketSent(
// If the last send was delayed, and the alarm took a long time to get
// invoked, allow the connection to make up for lost time.
if (was_last_send_delayed_) {
- next_packet_send_time_ = next_packet_send_time_.Add(delay);
+ ideal_next_packet_send_time_ = ideal_next_packet_send_time_.Add(delay);
// The send was application limited if it takes longer than the
// pacing delay between sent packets.
const bool application_limited =
last_delayed_packet_sent_time_.IsInitialized() &&
sent_time > last_delayed_packet_sent_time_.Add(delay);
- const bool making_up_for_lost_time = next_packet_send_time_ <= sent_time;
+ const bool making_up_for_lost_time =
+ ideal_next_packet_send_time_ <= sent_time;
// As long as we're making up time and not application limited,
// continue to consider the packets delayed, allowing the packets to be
// sent immediately.
@@ -86,9 +91,8 @@ bool PacingSender::OnPacketSent(
last_delayed_packet_sent_time_ = QuicTime::Zero();
}
} else {
- next_packet_send_time_ =
- QuicTime::Max(next_packet_send_time_.Add(delay),
- sent_time.Add(delay).Subtract(alarm_granularity_));
+ ideal_next_packet_send_time_ = QuicTime::Max(
+ ideal_next_packet_send_time_.Add(delay), sent_time.Add(delay));
}
return in_flight;
}
@@ -107,12 +111,8 @@ QuicTime::Delta PacingSender::TimeUntilSend(
HasRetransmittableData has_retransmittable_data) const {
QuicTime::Delta time_until_send =
sender_->TimeUntilSend(now, bytes_in_flight, has_retransmittable_data);
- if (bytes_in_flight == 0) {
- // Add more burst tokens anytime the connection is entering quiescence.
- burst_tokens_ = initial_packet_burst_;
- }
- if (burst_tokens_ > 0) {
- // Don't pace if we have burst tokens available.
+ if (burst_tokens_ > 0 || bytes_in_flight == 0) {
+ // Don't pace if we have burst tokens available or leaving quiescence.
return time_until_send;
}
@@ -129,13 +129,11 @@ QuicTime::Delta PacingSender::TimeUntilSend(
}
// If the next send time is within the alarm granularity, send immediately.
- // TODO(ianswett): This granularity logic ends up sending more packets than
- // intended in an effort to make up for lost time that wasn't lost.
- if (next_packet_send_time_ > now.Add(alarm_granularity_)) {
+ if (ideal_next_packet_send_time_ > now.Add(alarm_granularity_)) {
DVLOG(1) << "Delaying packet: "
- << next_packet_send_time_.Subtract(now).ToMicroseconds();
+ << ideal_next_packet_send_time_.Subtract(now).ToMicroseconds();
was_last_send_delayed_ = true;
- return next_packet_send_time_.Subtract(now);
+ return ideal_next_packet_send_time_.Subtract(now);
}
DVLOG(1) << "Sending packet now";
« no previous file with comments | « net/quic/congestion_control/pacing_sender.h ('k') | net/quic/congestion_control/pacing_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698