Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender.cc

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS; 24 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS;
25 const int kMaxBurstLength = 3; 25 const int kMaxBurstLength = 3;
26 const float kRenoBeta = 0.7f; // Reno backoff factor. 26 const float kRenoBeta = 0.7f; // Reno backoff factor.
27 const uint32 kDefaultNumConnections = 2; // N-connection emulation. 27 const uint32 kDefaultNumConnections = 2; // N-connection emulation.
28 } // namespace 28 } // namespace
29 29
30 TcpCubicSender::TcpCubicSender( 30 TcpCubicSender::TcpCubicSender(
31 const QuicClock* clock, 31 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 max_tcp_congestion_window, 35 QuicPacketCount max_tcp_congestion_window,
35 QuicConnectionStats* stats) 36 QuicConnectionStats* stats)
36 : hybrid_slow_start_(clock), 37 : hybrid_slow_start_(clock),
37 cubic_(clock, stats), 38 cubic_(clock, stats),
38 rtt_stats_(rtt_stats), 39 rtt_stats_(rtt_stats),
39 stats_(stats), 40 stats_(stats),
40 reno_(reno), 41 reno_(reno),
41 num_connections_(kDefaultNumConnections), 42 num_connections_(kDefaultNumConnections),
42 congestion_window_count_(0), 43 congestion_window_count_(0),
43 largest_sent_sequence_number_(0), 44 largest_sent_sequence_number_(0),
44 largest_acked_sequence_number_(0), 45 largest_acked_sequence_number_(0),
45 largest_sent_at_last_cutback_(0), 46 largest_sent_at_last_cutback_(0),
46 congestion_window_(kDefaultInitialWindow), 47 congestion_window_(initial_tcp_congestion_window),
47 previous_congestion_window_(0), 48 previous_congestion_window_(0),
48 slowstart_threshold_(max_tcp_congestion_window), 49 slowstart_threshold_(max_tcp_congestion_window),
49 previous_slowstart_threshold_(0), 50 previous_slowstart_threshold_(0),
50 last_cutback_exited_slowstart_(false), 51 last_cutback_exited_slowstart_(false),
51 max_tcp_congestion_window_(max_tcp_congestion_window) { 52 max_tcp_congestion_window_(max_tcp_congestion_window) {
52 } 53 }
53 54
54 TcpCubicSender::~TcpCubicSender() { 55 TcpCubicSender::~TcpCubicSender() {
55 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); 56 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_);
56 } 57 }
57 58
58 void TcpCubicSender::SetFromConfig(const QuicConfig& config, bool is_server) { 59 void TcpCubicSender::SetFromConfig(const QuicConfig& config,
60 bool is_server,
61 bool using_pacing) {
59 if (is_server) { 62 if (is_server) {
60 if (config.HasReceivedConnectionOptions() && 63 if (config.HasReceivedConnectionOptions() &&
61 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { 64 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) {
62 // Initial window experiment. Ignore the initial congestion 65 // Initial window experiment.
63 // window suggested by the client and use the default ICWND of 66 congestion_window_ = 10;
64 // 10 instead. 67 }
65 congestion_window_ = kDefaultInitialWindow; 68 if (using_pacing) {
66 } else if (config.HasReceivedInitialCongestionWindow()) { 69 // Disable the ack train mode in hystart when pacing is enabled, since it
67 // Set the initial window size. 70 // may be falsely triggered.
68 congestion_window_ = max(kMinimumCongestionWindow, 71 hybrid_slow_start_.set_ack_train_detection(false);
69 min(kMaxInitialWindow,
70 static_cast<QuicPacketCount>(
71 config.ReceivedInitialCongestionWindow())));
72 } 72 }
73 } 73 }
74 } 74 }
75 75
76 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) { 76 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) {
77 num_connections_ = max(1, num_connections); 77 num_connections_ = max(1, num_connections);
78 cubic_.SetNumConnections(num_connections_); 78 cubic_.SetNumConnections(num_connections_);
79 } 79 }
80 80
81 float TcpCubicSender::RenoBeta() const { 81 float TcpCubicSender::RenoBeta() const {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 congestion_window_ = previous_congestion_window_; 334 congestion_window_ = previous_congestion_window_;
335 slowstart_threshold_ = previous_slowstart_threshold_; 335 slowstart_threshold_ = previous_slowstart_threshold_;
336 previous_congestion_window_ = 0; 336 previous_congestion_window_ = 0;
337 } 337 }
338 338
339 CongestionControlType TcpCubicSender::GetCongestionControlType() const { 339 CongestionControlType TcpCubicSender::GetCongestionControlType() const {
340 return reno_ ? kReno : kCubic; 340 return reno_ ? kReno : kCubic;
341 } 341 }
342 342
343 } // namespace net 343 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.h ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698