| 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.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 congestion_window_count_(0), | 42 congestion_window_count_(0), |
| 43 largest_sent_sequence_number_(0), | 43 largest_sent_sequence_number_(0), |
| 44 largest_acked_sequence_number_(0), | 44 largest_acked_sequence_number_(0), |
| 45 largest_sent_at_last_cutback_(0), | 45 largest_sent_at_last_cutback_(0), |
| 46 congestion_window_(initial_tcp_congestion_window), | 46 congestion_window_(initial_tcp_congestion_window), |
| 47 min_congestion_window_(kDefaultMinimumCongestionWindow), | 47 min_congestion_window_(kDefaultMinimumCongestionWindow), |
| 48 slowstart_threshold_(max_tcp_congestion_window), | 48 slowstart_threshold_(max_tcp_congestion_window), |
| 49 last_cutback_exited_slowstart_(false), | 49 last_cutback_exited_slowstart_(false), |
| 50 max_tcp_congestion_window_(max_tcp_congestion_window), | 50 max_tcp_congestion_window_(max_tcp_congestion_window), |
| 51 clock_(clock) { | 51 clock_(clock) { |
| 52 // Disable the ack train mode in hystart when pacing is enabled, since it |
| 53 // may be falsely triggered. |
| 54 hybrid_slow_start_.set_ack_train_detection(false); |
| 52 } | 55 } |
| 53 | 56 |
| 54 TcpCubicSender::~TcpCubicSender() { | 57 TcpCubicSender::~TcpCubicSender() { |
| 55 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); | 58 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void TcpCubicSender::SetFromConfig(const QuicConfig& config, | 61 void TcpCubicSender::SetFromConfig(const QuicConfig& config, |
| 59 Perspective perspective, | 62 Perspective perspective) { |
| 60 bool using_pacing) { | |
| 61 if (perspective == Perspective::IS_SERVER) { | 63 if (perspective == Perspective::IS_SERVER) { |
| 62 if (config.HasReceivedConnectionOptions() && | 64 if (config.HasReceivedConnectionOptions() && |
| 63 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { | 65 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { |
| 64 // Initial window experiment. | 66 // Initial window experiment. |
| 65 congestion_window_ = 10; | 67 congestion_window_ = 10; |
| 66 } | 68 } |
| 67 if (config.HasReceivedConnectionOptions() && | 69 if (config.HasReceivedConnectionOptions() && |
| 68 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN1)) { | 70 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN1)) { |
| 69 // Min CWND experiment. | 71 // Min CWND experiment. |
| 70 min_congestion_window_ = 1; | 72 min_congestion_window_ = 1; |
| 71 } | 73 } |
| 72 if (using_pacing) { | |
| 73 // Disable the ack train mode in hystart when pacing is enabled, since it | |
| 74 // may be falsely triggered. | |
| 75 hybrid_slow_start_.set_ack_train_detection(false); | |
| 76 } | |
| 77 } | 74 } |
| 78 } | 75 } |
| 79 | 76 |
| 80 bool TcpCubicSender::ResumeConnectionState( | 77 bool TcpCubicSender::ResumeConnectionState( |
| 81 const CachedNetworkParameters& cached_network_params, | 78 const CachedNetworkParameters& cached_network_params, |
| 82 bool max_bandwidth_resumption) { | 79 bool max_bandwidth_resumption) { |
| 83 // If the previous bandwidth estimate is less than an hour old, store in | 80 // If the previous bandwidth estimate is less than an hour old, store in |
| 84 // preparation for doing bandwidth resumption. | 81 // preparation for doing bandwidth resumption. |
| 85 int64 seconds_since_estimate = | 82 int64 seconds_since_estimate = |
| 86 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); | 83 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 hybrid_slow_start_.Restart(); | 361 hybrid_slow_start_.Restart(); |
| 365 slowstart_threshold_ = congestion_window_ / 2; | 362 slowstart_threshold_ = congestion_window_ / 2; |
| 366 congestion_window_ = min_congestion_window_; | 363 congestion_window_ = min_congestion_window_; |
| 367 } | 364 } |
| 368 | 365 |
| 369 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 366 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
| 370 return reno_ ? kReno : kCubic; | 367 return reno_ ? kReno : kCubic; |
| 371 } | 368 } |
| 372 | 369 |
| 373 } // namespace net | 370 } // namespace net |
| OLD | NEW |