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

Side by Side Diff: net/quic/quic_sent_packet_manager.cc

Issue 682293004: Change the number of emulated connections in QUIC's congestion control (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge_78853598
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
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 is_server_(is_server), 71 is_server_(is_server),
72 clock_(clock), 72 clock_(clock),
73 stats_(stats), 73 stats_(stats),
74 debug_delegate_(nullptr), 74 debug_delegate_(nullptr),
75 network_change_visitor_(nullptr), 75 network_change_visitor_(nullptr),
76 send_algorithm_(SendAlgorithmInterface::Create(clock, 76 send_algorithm_(SendAlgorithmInterface::Create(clock,
77 &rtt_stats_, 77 &rtt_stats_,
78 congestion_control_type, 78 congestion_control_type,
79 stats)), 79 stats)),
80 loss_algorithm_(LossDetectionInterface::Create(loss_type)), 80 loss_algorithm_(LossDetectionInterface::Create(loss_type)),
81 n_connection_simulation_(false),
81 receive_buffer_bytes_(kDefaultSocketReceiveBuffer), 82 receive_buffer_bytes_(kDefaultSocketReceiveBuffer),
82 least_packet_awaited_by_peer_(1), 83 least_packet_awaited_by_peer_(1),
83 first_rto_transmission_(0), 84 first_rto_transmission_(0),
84 consecutive_rto_count_(0), 85 consecutive_rto_count_(0),
85 consecutive_tlp_count_(0), 86 consecutive_tlp_count_(0),
86 consecutive_crypto_retransmission_count_(0), 87 consecutive_crypto_retransmission_count_(0),
87 pending_timer_transmission_count_(0), 88 pending_timer_transmission_count_(0),
88 max_tail_loss_probes_(kDefaultMaxTailLossProbes), 89 max_tail_loss_probes_(kDefaultMaxTailLossProbes),
89 using_pacing_(false), 90 using_pacing_(false),
90 handshake_confirmed_(false) { 91 handshake_confirmed_(false) {
(...skipping 27 matching lines...) Expand all
118 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { 119 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) {
119 send_algorithm_.reset( 120 send_algorithm_.reset(
120 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_)); 121 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_));
121 } 122 }
122 if (HasClientSentConnectionOption(config, kPACE)) { 123 if (HasClientSentConnectionOption(config, kPACE)) {
123 EnablePacing(); 124 EnablePacing();
124 } 125 }
125 if (HasClientSentConnectionOption(config, k1CON)) { 126 if (HasClientSentConnectionOption(config, k1CON)) {
126 send_algorithm_->SetNumEmulatedConnections(1); 127 send_algorithm_->SetNumEmulatedConnections(1);
127 } 128 }
129 if (HasClientSentConnectionOption(config, kNCON)) {
130 n_connection_simulation_ = true;
131 }
128 if (HasClientSentConnectionOption(config, kNTLP)) { 132 if (HasClientSentConnectionOption(config, kNTLP)) {
129 max_tail_loss_probes_ = 0; 133 max_tail_loss_probes_ = 0;
130 } 134 }
131 if (config.HasReceivedConnectionOptions() && 135 if (config.HasReceivedConnectionOptions() &&
132 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { 136 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) {
133 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); 137 loss_algorithm_.reset(LossDetectionInterface::Create(kTime));
134 } 138 }
135 if (config.HasReceivedSocketReceiveBuffer()) { 139 if (config.HasReceivedSocketReceiveBuffer()) {
136 receive_buffer_bytes_ = 140 receive_buffer_bytes_ =
137 max(kMinSocketReceiveBuffer, 141 max(kMinSocketReceiveBuffer,
138 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); 142 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer()));
139 } 143 }
140 send_algorithm_->SetFromConfig(config, is_server_); 144 send_algorithm_->SetFromConfig(config, is_server_);
141 145
142 if (network_change_visitor_ != nullptr) { 146 if (network_change_visitor_ != nullptr) {
143 network_change_visitor_->OnCongestionWindowChange(GetCongestionWindow()); 147 network_change_visitor_->OnCongestionWindowChange(GetCongestionWindow());
144 } 148 }
145 } 149 }
146 150
151 void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) {
152 if (n_connection_simulation_) {
153 // Ensure the number of connections is between 1 and 5.
154 send_algorithm_->SetNumEmulatedConnections(
155 min<size_t>(5, max<size_t>(1, num_streams)));
156 }
157 }
158
147 bool QuicSentPacketManager::HasClientSentConnectionOption( 159 bool QuicSentPacketManager::HasClientSentConnectionOption(
148 const QuicConfig& config, QuicTag tag) const { 160 const QuicConfig& config, QuicTag tag) const {
149 if (is_server_) { 161 if (is_server_) {
150 if (config.HasReceivedConnectionOptions() && 162 if (config.HasReceivedConnectionOptions() &&
151 ContainsQuicTag(config.ReceivedConnectionOptions(), tag)) { 163 ContainsQuicTag(config.ReceivedConnectionOptions(), tag)) {
152 return true; 164 return true;
153 } 165 }
154 } else if (config.HasSendConnectionOptions() && 166 } else if (config.HasSendConnectionOptions() &&
155 ContainsQuicTag(config.SendConnectionOptions(), tag)) { 167 ContainsQuicTag(config.SendConnectionOptions(), tag)) {
156 return true; 168 return true;
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as 894 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as
883 // the default granularity of the Linux kernel's FQ qdisc. 895 // the default granularity of the Linux kernel's FQ qdisc.
884 using_pacing_ = true; 896 using_pacing_ = true;
885 send_algorithm_.reset( 897 send_algorithm_.reset(
886 new PacingSender(send_algorithm_.release(), 898 new PacingSender(send_algorithm_.release(),
887 QuicTime::Delta::FromMilliseconds(1), 899 QuicTime::Delta::FromMilliseconds(1),
888 kInitialUnpacedBurst)); 900 kInitialUnpacedBurst));
889 } 901 }
890 902
891 } // namespace net 903 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698