| 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_);
|
|
|