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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 5fa15598bbeb9d4607f1598b5b8e91e6439233a6..2378eeb179101946ab0499295c4d9bf6f9d06f7f 100644
--- a/net/quic/congestion_control/tcp_cubic_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc
@@ -72,24 +72,30 @@ void TcpCubicSender::SetFromConfig(const QuicConfig& config,
}
}
-void TcpCubicSender::ResumeConnectionState(
+bool TcpCubicSender::ResumeConnectionState(
const CachedNetworkParameters& cached_network_params) {
// If the previous bandwidth estimate is less than an hour old, store in
// preparation for doing bandwidth resumption.
int64 seconds_since_estimate =
clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp();
if (seconds_since_estimate > kNumSecondsPerHour) {
- return;
+ return false;
}
QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond(
cached_network_params.bandwidth_estimate_bytes_per_second());
QuicTime::Delta rtt_ms =
QuicTime::Delta::FromMilliseconds(cached_network_params.min_rtt_ms());
- congestion_window_ = bandwidth.ToBytesPerPeriod(rtt_ms) / kMaxPacketSize;
+
+ // Make sure CWND is in appropriate range (in case of bad data).
+ QuicPacketCount new_congestion_window =
+ bandwidth.ToBytesPerPeriod(rtt_ms) / kMaxPacketSize;
+ congestion_window_ = max(min(new_congestion_window, kMaxTcpCongestionWindow),
+ kMinCongestionWindowForBandwidthResumption);
// TODO(rjshade): Set appropriate CWND when previous connection was in slow
// start at time of estimate.
+ return true;
}
void TcpCubicSender::SetNumEmulatedConnections(int num_connections) {
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.h ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698