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

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

Issue 667763003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
Index: net/quic/congestion_control/tcp_cubic_sender.cc
diff --git a/net/quic/congestion_control/tcp_cubic_sender.cc b/net/quic/congestion_control/tcp_cubic_sender.cc
index 0aae5fdea714c109ed5fbcf3c3aff448fa03d74d..91b95cf29e85f2d6b692c81575bfc2dacc2f90f9 100644
--- a/net/quic/congestion_control/tcp_cubic_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc
@@ -98,7 +98,7 @@ void TcpCubicSender::OnCongestionEvent(
const CongestionVector& lost_packets) {
if (rtt_updated && InSlowStart() &&
hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(),
- rtt_stats_->min_rtt(),
+ rtt_stats_->MinRtt(),
congestion_window_)) {
slowstart_threshold_ = congestion_window_;
}
@@ -204,7 +204,18 @@ QuicByteCount TcpCubicSender::SendWindow() const {
return min(receive_window_, GetCongestionWindow());
}
+QuicBandwidth TcpCubicSender::PacingRate() const {
+ // We pace at twice the rate of the underlying sender's bandwidth estimate
+ // during slow start and 1.25x during congestion avoidance to ensure pacing
+ // doesn't prevent us from filling the window.
+ return BandwidthEstimate().Scale(InSlowStart() ? 2 : 1.25);
+}
+
QuicBandwidth TcpCubicSender::BandwidthEstimate() const {
+ if (rtt_stats_->SmoothedRtt().IsZero()) {
+ LOG(DFATAL) << "In BandwidthEstimate(), smoothed RTT is zero!";
+ return QuicBandwidth::Zero();
+ }
return QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(),
rtt_stats_->SmoothedRtt());
}
@@ -217,9 +228,8 @@ QuicTime::Delta TcpCubicSender::RetransmissionDelay() const {
if (!rtt_stats_->HasUpdates()) {
return QuicTime::Delta::Zero();
}
- return QuicTime::Delta::FromMicroseconds(
- rtt_stats_->SmoothedRtt().ToMicroseconds() +
- 4 * rtt_stats_->mean_deviation().ToMicroseconds());
+ return rtt_stats_->SmoothedRtt().Add(
+ rtt_stats_->mean_deviation().Multiply(4));
}
QuicByteCount TcpCubicSender::GetCongestionWindow() const {
@@ -294,7 +304,7 @@ void TcpCubicSender::MaybeIncreaseCwnd(
} else {
congestion_window_ = min(max_tcp_congestion_window_,
cubic_.CongestionWindowAfterAck(
- congestion_window_, rtt_stats_->min_rtt()));
+ congestion_window_, rtt_stats_->MinRtt()));
DVLOG(1) << "Cubic; congestion window: " << congestion_window_
<< " slowstart threshold: " << slowstart_threshold_;
}
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.h ('k') | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698