OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_bytes_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "net/quic/congestion_control/prr_sender.h" | 9 #include "net/quic/congestion_control/prr_sender.h" |
10 #include "net/quic/congestion_control/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 num_acked_packets_(0), | 42 num_acked_packets_(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 * kMaxSegmentSize), | 46 congestion_window_(initial_tcp_congestion_window * kMaxSegmentSize), |
47 min_congestion_window_(kDefaultMinimumCongestionWindow), | 47 min_congestion_window_(kDefaultMinimumCongestionWindow), |
48 max_congestion_window_(max_congestion_window * kMaxSegmentSize), | 48 max_congestion_window_(max_congestion_window * kMaxSegmentSize), |
49 slowstart_threshold_(std::numeric_limits<uint64>::max()), | 49 slowstart_threshold_(std::numeric_limits<uint64>::max()), |
50 last_cutback_exited_slowstart_(false), | 50 last_cutback_exited_slowstart_(false), |
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 TcpCubicBytesSender::~TcpCubicBytesSender() { | 57 TcpCubicBytesSender::~TcpCubicBytesSender() { |
55 } | 58 } |
56 | 59 |
57 void TcpCubicBytesSender::SetFromConfig(const QuicConfig& config, | 60 void TcpCubicBytesSender::SetFromConfig(const QuicConfig& config, |
58 Perspective perspective, | 61 Perspective perspective) { |
59 bool using_pacing) { | |
60 if (perspective == Perspective::IS_SERVER) { | 62 if (perspective == Perspective::IS_SERVER) { |
61 if (config.HasReceivedConnectionOptions() && | 63 if (config.HasReceivedConnectionOptions() && |
62 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { | 64 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { |
63 // Initial window experiment. | 65 // Initial window experiment. |
64 congestion_window_ = 10 * kMaxSegmentSize; | 66 congestion_window_ = 10 * kMaxSegmentSize; |
65 } | 67 } |
66 if (config.HasReceivedConnectionOptions() && | 68 if (config.HasReceivedConnectionOptions() && |
67 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN1)) { | 69 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN1)) { |
68 // Min CWND experiment. | 70 // Min CWND experiment. |
69 min_congestion_window_ = kMaxSegmentSize; | 71 min_congestion_window_ = kMaxSegmentSize; |
70 } | 72 } |
71 if (using_pacing) { | |
72 // Disable the ack train mode in hystart when pacing is enabled, since it | |
73 // may be falsely triggered. | |
74 hybrid_slow_start_.set_ack_train_detection(false); | |
75 } | |
76 } | 73 } |
77 } | 74 } |
78 | 75 |
79 bool TcpCubicBytesSender::ResumeConnectionState( | 76 bool TcpCubicBytesSender::ResumeConnectionState( |
80 const CachedNetworkParameters& cached_network_params, | 77 const CachedNetworkParameters& cached_network_params, |
81 bool max_bandwidth_resumption) { | 78 bool max_bandwidth_resumption) { |
82 // If the previous bandwidth estimate is less than an hour old, store in | 79 // If the previous bandwidth estimate is less than an hour old, store in |
83 // preparation for doing bandwidth resumption. | 80 // preparation for doing bandwidth resumption. |
84 int64 seconds_since_estimate = | 81 int64 seconds_since_estimate = |
85 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); | 82 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 hybrid_slow_start_.Restart(); | 356 hybrid_slow_start_.Restart(); |
360 slowstart_threshold_ = congestion_window_ / 2; | 357 slowstart_threshold_ = congestion_window_ / 2; |
361 congestion_window_ = min_congestion_window_; | 358 congestion_window_ = min_congestion_window_; |
362 } | 359 } |
363 | 360 |
364 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { | 361 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { |
365 return reno_ ? kRenoBytes : kCubicBytes; | 362 return reno_ ? kRenoBytes : kCubicBytes; |
366 } | 363 } |
367 | 364 |
368 } // namespace net | 365 } // namespace net |
OLD | NEW |