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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 2d0efd769af54f11b16c6e676db88d8e780fd04c..5fa15598bbeb9d4607f1598b5b8e91e6439233a6 100644
--- a/net/quic/congestion_control/tcp_cubic_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc
@@ -27,13 +27,12 @@ const float kRenoBeta = 0.7f; // Reno backoff factor.
const uint32 kDefaultNumConnections = 2; // N-connection emulation.
} // namespace
-TcpCubicSender::TcpCubicSender(
- const QuicClock* clock,
- const RttStats* rtt_stats,
- bool reno,
- QuicPacketCount initial_tcp_congestion_window,
- QuicPacketCount max_tcp_congestion_window,
- QuicConnectionStats* stats)
+TcpCubicSender::TcpCubicSender(const QuicClock* clock,
+ const RttStats* rtt_stats,
+ bool reno,
+ QuicPacketCount initial_tcp_congestion_window,
+ QuicPacketCount max_tcp_congestion_window,
+ QuicConnectionStats* stats)
: hybrid_slow_start_(clock),
cubic_(clock, stats),
rtt_stats_(rtt_stats),
@@ -49,8 +48,8 @@ TcpCubicSender::TcpCubicSender(
slowstart_threshold_(max_tcp_congestion_window),
previous_slowstart_threshold_(0),
last_cutback_exited_slowstart_(false),
- max_tcp_congestion_window_(max_tcp_congestion_window) {
-}
+ max_tcp_congestion_window_(max_tcp_congestion_window),
+ clock_(clock) {}
TcpCubicSender::~TcpCubicSender() {
UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_);
@@ -73,6 +72,26 @@ void TcpCubicSender::SetFromConfig(const QuicConfig& config,
}
}
+void 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;
+ }
+
+ 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;
+
+ // TODO(rjshade): Set appropriate CWND when previous connection was in slow
+ // start at time of estimate.
+}
+
void TcpCubicSender::SetNumEmulatedConnections(int num_connections) {
num_connections_ = max(1, num_connections);
cubic_.SetNumConnections(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