| Index: net/quic/congestion_control/cubic.cc
|
| diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc
|
| index f64e58b05b949eb16618fa27a0b741497d1cc269..c0d08781ab5d06cdbf6e2007f3aeb0a783be7181 100644
|
| --- a/net/quic/congestion_control/cubic.cc
|
| +++ b/net/quic/congestion_control/cubic.cc
|
| @@ -25,8 +25,8 @@ const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3)
|
| // where 0.100 is 100 ms which is the scaling
|
| // round trip time.
|
| const int kCubeCongestionWindowScale = 410;
|
| -const uint64 kCubeFactor = (GG_UINT64_C(1) << kCubeScale) /
|
| - kCubeCongestionWindowScale;
|
| +const uint64 kCubeFactor =
|
| + (GG_UINT64_C(1) << kCubeScale) / kCubeCongestionWindowScale;
|
|
|
| const uint32 kNumConnections = 2;
|
| const float kBeta = 0.7f; // Default Cubic backoff factor.
|
| @@ -44,7 +44,7 @@ const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections;
|
| // kBeta here is a cwnd multiplier, and is equal to 1-beta from the CUBIC paper.
|
| // We derive the equivalent kNConnectionAlpha for an N-connection emulation as:
|
| const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
|
| - (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
|
| + (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
|
| // TODO(jri): Compute kNConnectionBeta and kNConnectionAlpha from
|
| // number of active streams.
|
|
|
| @@ -59,7 +59,7 @@ Cubic::Cubic(const QuicClock* clock, QuicConnectionStats* stats)
|
| }
|
|
|
| void Cubic::Reset() {
|
| - epoch_ = QuicTime::Zero(); // Reset time.
|
| + epoch_ = QuicTime::Zero(); // Reset time.
|
| last_update_time_ = QuicTime::Zero(); // Reset time.
|
| last_congestion_window_ = 0;
|
| last_max_congestion_window_ = 0;
|
| @@ -73,9 +73,8 @@ void Cubic::Reset() {
|
| void Cubic::UpdateCongestionControlStats(
|
| QuicTcpCongestionWindow new_cubic_mode_cwnd,
|
| QuicTcpCongestionWindow new_reno_mode_cwnd) {
|
| -
|
| - QuicTcpCongestionWindow highest_new_cwnd = std::max(new_cubic_mode_cwnd,
|
| - new_reno_mode_cwnd);
|
| + QuicTcpCongestionWindow highest_new_cwnd =
|
| + std::max(new_cubic_mode_cwnd, new_reno_mode_cwnd);
|
| if (last_congestion_window_ < highest_new_cwnd) {
|
| // cwnd will increase to highest_new_cwnd.
|
| stats_->cwnd_increase_congestion_avoidance +=
|
| @@ -120,7 +119,7 @@ QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
|
| if (!epoch_.IsInitialized()) {
|
| // First ACK after a loss event.
|
| DVLOG(1) << "Start of epoch";
|
| - epoch_ = current_time; // Start of epoch.
|
| + epoch_ = current_time; // Start of epoch.
|
| acked_packets_count_ = 1; // Reset count.
|
| // Reset estimated_tcp_congestion_window_ to be in sync with cubic.
|
| estimated_tcp_congestion_window_ = current_congestion_window;
|
| @@ -128,10 +127,10 @@ QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
|
| time_to_origin_point_ = 0;
|
| origin_point_congestion_window_ = current_congestion_window;
|
| } else {
|
| - time_to_origin_point_ = CubeRoot::Root(kCubeFactor *
|
| - (last_max_congestion_window_ - current_congestion_window));
|
| - origin_point_congestion_window_ =
|
| - last_max_congestion_window_;
|
| + time_to_origin_point_ =
|
| + CubeRoot::Root(kCubeFactor * (last_max_congestion_window_ -
|
| + current_congestion_window));
|
| + origin_point_congestion_window_ = last_max_congestion_window_;
|
| }
|
| }
|
| // Change the time unit from microseconds to 2^10 fractions per second. Take
|
| @@ -142,8 +141,8 @@ QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
|
| base::Time::kMicrosecondsPerSecond;
|
|
|
| int64 offset = time_to_origin_point_ - elapsed_time;
|
| - QuicTcpCongestionWindow delta_congestion_window = (kCubeCongestionWindowScale
|
| - * offset * offset * offset) >> kCubeScale;
|
| + QuicTcpCongestionWindow delta_congestion_window =
|
| + (kCubeCongestionWindowScale * offset * offset * offset) >> kCubeScale;
|
|
|
| QuicTcpCongestionWindow target_congestion_window =
|
| origin_point_congestion_window_ - delta_congestion_window;
|
|
|