| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| 11 #include "net/quic/congestion_control/rtt_stats.h" | 11 #include "net/quic/congestion_control/rtt_stats.h" |
| 12 #include "net/quic/crypto/crypto_protocol.h" | 12 #include "net/quic/crypto/crypto_protocol.h" |
| 13 #include "net/quic/proto/cached_network_parameters.pb.h" | 13 #include "net/quic/proto/cached_network_parameters.pb.h" |
| 14 #include "net/quic/quic_flags.h" | 14 #include "net/quic/quic_flags.h" |
| 15 | 15 |
| 16 using std::max; | 16 using std::max; |
| 17 using std::min; | 17 using std::min; |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 // Constants based on TCP defaults. | 22 // Constants based on TCP defaults. |
| 23 // The minimum cwnd based on RFC 3782 (TCP NewReno) for cwnd reductions on a | 23 // The minimum cwnd based on RFC 3782 (TCP NewReno) for cwnd reductions on a |
| 24 // fast retransmission. The cwnd after a timeout is still 1. | 24 // fast retransmission. The cwnd after a timeout is still 1. |
| 25 const QuicPacketCount kDefaultMinimumCongestionWindow = 2; | 25 const QuicPacketCount kDefaultMinimumCongestionWindow = 2; |
| 26 const QuicByteCount kMaxBurstBytes = 3 * kDefaultTCPMSS; | 26 const QuicByteCount kMaxBurstBytes = 3 * kDefaultTCPMSS; |
| 27 const float kRenoBeta = 0.7f; // Reno backoff factor. | 27 const float kRenoBeta = 0.7f; // Reno backoff factor. |
| 28 const uint32 kDefaultNumConnections = 2; // N-connection emulation. | 28 const uint32_t kDefaultNumConnections = 2; // N-connection emulation. |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 TcpCubicSender::TcpCubicSender(const QuicClock* clock, | 31 TcpCubicSender::TcpCubicSender(const QuicClock* clock, |
| 32 const RttStats* rtt_stats, | 32 const RttStats* rtt_stats, |
| 33 bool reno, | 33 bool reno, |
| 34 QuicPacketCount initial_tcp_congestion_window, | 34 QuicPacketCount initial_tcp_congestion_window, |
| 35 QuicPacketCount max_tcp_congestion_window, | 35 QuicPacketCount max_tcp_congestion_window, |
| 36 QuicConnectionStats* stats) | 36 QuicConnectionStats* stats) |
| 37 : cubic_(clock), | 37 : cubic_(clock), |
| 38 rtt_stats_(rtt_stats), | 38 rtt_stats_(rtt_stats), |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 slowstart_threshold_ = initial_max_tcp_congestion_window_; | 374 slowstart_threshold_ = initial_max_tcp_congestion_window_; |
| 375 last_cutback_exited_slowstart_ = false; | 375 last_cutback_exited_slowstart_ = false; |
| 376 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; | 376 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; |
| 377 } | 377 } |
| 378 | 378 |
| 379 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 379 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
| 380 return reno_ ? kReno : kCubic; | 380 return reno_ ? kReno : kCubic; |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace net | 383 } // namespace net |
| OLD | NEW |