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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 if (using_pacing) { | 71 if (using_pacing) { |
72 // Disable the ack train mode in hystart when pacing is enabled, since it | 72 // Disable the ack train mode in hystart when pacing is enabled, since it |
73 // may be falsely triggered. | 73 // may be falsely triggered. |
74 hybrid_slow_start_.set_ack_train_detection(false); | 74 hybrid_slow_start_.set_ack_train_detection(false); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 bool TcpCubicBytesSender::ResumeConnectionState( | 79 bool TcpCubicBytesSender::ResumeConnectionState( |
80 const CachedNetworkParameters& cached_network_params) { | 80 const CachedNetworkParameters& cached_network_params, |
| 81 bool max_bandwidth_resumption) { |
81 // If the previous bandwidth estimate is less than an hour old, store in | 82 // If the previous bandwidth estimate is less than an hour old, store in |
82 // preparation for doing bandwidth resumption. | 83 // preparation for doing bandwidth resumption. |
83 int64 seconds_since_estimate = | 84 int64 seconds_since_estimate = |
84 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); | 85 clock_->WallNow().ToUNIXSeconds() - cached_network_params.timestamp(); |
85 if (seconds_since_estimate > kNumSecondsPerHour) { | 86 if (seconds_since_estimate > kNumSecondsPerHour) { |
86 return false; | 87 return false; |
87 } | 88 } |
88 | 89 |
89 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond( | 90 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond( |
90 cached_network_params.bandwidth_estimate_bytes_per_second()); | 91 max_bandwidth_resumption |
| 92 ? cached_network_params.max_bandwidth_estimate_bytes_per_second() |
| 93 : cached_network_params.bandwidth_estimate_bytes_per_second()); |
91 QuicTime::Delta rtt_ms = | 94 QuicTime::Delta rtt_ms = |
92 QuicTime::Delta::FromMilliseconds(cached_network_params.min_rtt_ms()); | 95 QuicTime::Delta::FromMilliseconds(cached_network_params.min_rtt_ms()); |
93 | 96 |
94 // Make sure CWND is in appropriate range (in case of bad data). | 97 // Make sure CWND is in appropriate range (in case of bad data). |
95 QuicByteCount new_congestion_window = bandwidth.ToBytesPerPeriod(rtt_ms); | 98 QuicByteCount new_congestion_window = bandwidth.ToBytesPerPeriod(rtt_ms); |
96 congestion_window_ = | 99 congestion_window_ = |
97 max(min(new_congestion_window, kMaxTcpCongestionWindow * kMaxSegmentSize), | 100 max(min(new_congestion_window, kMaxTcpCongestionWindow * kMaxSegmentSize), |
98 kMinCongestionWindowForBandwidthResumption * kMaxSegmentSize); | 101 kMinCongestionWindowForBandwidthResumption * kMaxSegmentSize); |
99 | 102 |
100 // TODO(rjshade): Set appropriate CWND when previous connection was in slow | 103 // TODO(rjshade): Set appropriate CWND when previous connection was in slow |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 hybrid_slow_start_.Restart(); | 355 hybrid_slow_start_.Restart(); |
353 slowstart_threshold_ = congestion_window_ / 2; | 356 slowstart_threshold_ = congestion_window_ / 2; |
354 congestion_window_ = min_congestion_window_; | 357 congestion_window_ = min_congestion_window_; |
355 } | 358 } |
356 | 359 |
357 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { | 360 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { |
358 return reno_ ? kRenoBytes : kCubicBytes; | 361 return reno_ ? kRenoBytes : kCubicBytes; |
359 } | 362 } |
360 | 363 |
361 } // namespace net | 364 } // namespace net |
OLD | NEW |