OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" | 5 #include "net/quic/core/congestion_control/bbr_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "net/quic/core/congestion_control/rtt_stats.h" | 10 #include "net/quic/core/congestion_control/rtt_stats.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 congestion_window_gain_ = kHighGain; | 295 congestion_window_gain_ = kHighGain; |
296 } | 296 } |
297 | 297 |
298 void BbrSender::EnterProbeBandwidthMode(QuicTime now) { | 298 void BbrSender::EnterProbeBandwidthMode(QuicTime now) { |
299 mode_ = PROBE_BW; | 299 mode_ = PROBE_BW; |
300 congestion_window_gain_ = congestion_window_gain_constant_; | 300 congestion_window_gain_ = congestion_window_gain_constant_; |
301 | 301 |
302 // Pick a random offset for the gain cycle out of {0, 2..7} range. 1 is | 302 // Pick a random offset for the gain cycle out of {0, 2..7} range. 1 is |
303 // excluded because in that case increased gain and decreased gain would not | 303 // excluded because in that case increased gain and decreased gain would not |
304 // follow each other. | 304 // follow each other. |
305 cycle_current_offset_ = | 305 cycle_current_offset_ = random_->RandUint64() % (kGainCycleLength - 1); |
306 random_->RandUint64() % (sizeof(kGainCycleLength) - 1); | |
307 if (cycle_current_offset_ >= 1) { | 306 if (cycle_current_offset_ >= 1) { |
308 cycle_current_offset_ += 1; | 307 cycle_current_offset_ += 1; |
309 } | 308 } |
310 | 309 |
311 last_cycle_start_ = now; | 310 last_cycle_start_ = now; |
312 pacing_gain_ = kPacingGain[cycle_current_offset_]; | 311 pacing_gain_ = kPacingGain[cycle_current_offset_]; |
313 } | 312 } |
314 | 313 |
315 void BbrSender::DiscardLostPackets(const CongestionVector& lost_packets) { | 314 void BbrSender::DiscardLostPackets(const CongestionVector& lost_packets) { |
316 for (const auto& packet : lost_packets) { | 315 for (const auto& packet : lost_packets) { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() | 712 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() |
714 << std::endl; | 713 << std::endl; |
715 | 714 |
716 os << "Last sample is app-limited: " | 715 os << "Last sample is app-limited: " |
717 << (state.last_sample_is_app_limited ? "yes" : "no"); | 716 << (state.last_sample_is_app_limited ? "yes" : "no"); |
718 | 717 |
719 return os; | 718 return os; |
720 } | 719 } |
721 | 720 |
722 } // namespace net | 721 } // namespace net |
OLD | NEW |