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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_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 (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/cubic.h" 5 #include "net/quic/congestion_control/cubic.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 QuicPacketCount target_congestion_window = 155 QuicPacketCount target_congestion_window =
156 origin_point_congestion_window_ - delta_congestion_window; 156 origin_point_congestion_window_ - delta_congestion_window;
157 157
158 DCHECK_LT(0u, estimated_tcp_congestion_window_); 158 DCHECK_LT(0u, estimated_tcp_congestion_window_);
159 // With dynamic beta/alpha based on number of active streams, it is possible 159 // With dynamic beta/alpha based on number of active streams, it is possible
160 // for the required_ack_count to become much lower than acked_packets_count_ 160 // for the required_ack_count to become much lower than acked_packets_count_
161 // suddenly, leading to more than one iteration through the following loop. 161 // suddenly, leading to more than one iteration through the following loop.
162 while (true) { 162 while (true) {
163 // Update estimated TCP congestion_window. 163 // Update estimated TCP congestion_window.
164 uint32 required_ack_count = 164 QuicPacketCount required_ack_count = static_cast<QuicPacketCount>(
165 estimated_tcp_congestion_window_ / Alpha(); 165 estimated_tcp_congestion_window_ / Alpha());
166 if (acked_packets_count_ < required_ack_count) { 166 if (acked_packets_count_ < required_ack_count) {
167 break; 167 break;
168 } 168 }
169 acked_packets_count_ -= required_ack_count; 169 acked_packets_count_ -= required_ack_count;
170 estimated_tcp_congestion_window_++; 170 estimated_tcp_congestion_window_++;
171 } 171 }
172 172
173 // Update cubic mode and reno mode stats in QuicConnectionStats. 173 // Update cubic mode and reno mode stats in QuicConnectionStats.
174 UpdateCongestionControlStats(target_congestion_window, 174 UpdateCongestionControlStats(target_congestion_window,
175 estimated_tcp_congestion_window_); 175 estimated_tcp_congestion_window_);
176 176
177 // We have a new cubic congestion window. 177 // We have a new cubic congestion window.
178 last_target_congestion_window_ = target_congestion_window; 178 last_target_congestion_window_ = target_congestion_window;
179 179
180 // Compute target congestion_window based on cubic target and estimated TCP 180 // Compute target congestion_window based on cubic target and estimated TCP
181 // congestion_window, use highest (fastest). 181 // congestion_window, use highest (fastest).
182 if (target_congestion_window < estimated_tcp_congestion_window_) { 182 if (target_congestion_window < estimated_tcp_congestion_window_) {
183 target_congestion_window = estimated_tcp_congestion_window_; 183 target_congestion_window = estimated_tcp_congestion_window_;
184 } 184 }
185 185
186 DVLOG(1) << "Target congestion_window: " << target_congestion_window; 186 DVLOG(1) << "Target congestion_window: " << target_congestion_window;
187 return target_congestion_window; 187 return target_congestion_window;
188 } 188 }
189 189
190 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698