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

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

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/fix_rate_sender.h » ('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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 last_max_congestion_window_ = current_congestion_window; 127 last_max_congestion_window_ = current_congestion_window;
128 } 128 }
129 epoch_ = QuicTime::Zero(); // Reset time. 129 epoch_ = QuicTime::Zero(); // Reset time.
130 return (current_congestion_window * kBeta) >> 10; 130 return (current_congestion_window * kBeta) >> 10;
131 } 131 }
132 132
133 QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck( 133 QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
134 QuicTcpCongestionWindow current_congestion_window, 134 QuicTcpCongestionWindow current_congestion_window,
135 QuicTime::Delta delay_min) { 135 QuicTime::Delta delay_min) {
136 acked_packets_count_ += 1; // Packets acked. 136 acked_packets_count_ += 1; // Packets acked.
137 QuicTime current_time = clock_->Now(); 137 QuicTime current_time = clock_->ApproximateNow();
138 138
139 // Cubic is "independent" of RTT, the update is limited by the time elapsed. 139 // Cubic is "independent" of RTT, the update is limited by the time elapsed.
140 if (last_congestion_window_ == current_congestion_window && 140 if (last_congestion_window_ == current_congestion_window &&
141 (current_time.Subtract(last_update_time_) <= MaxCubicTimeInterval())) { 141 (current_time.Subtract(last_update_time_) <= MaxCubicTimeInterval())) {
142 DCHECK(epoch_.IsInitialized());
143 return std::max(last_target_congestion_window_, 142 return std::max(last_target_congestion_window_,
144 estimated_tcp_congestion_window_); 143 estimated_tcp_congestion_window_);
145 } 144 }
146 last_congestion_window_ = current_congestion_window; 145 last_congestion_window_ = current_congestion_window;
147 last_update_time_ = current_time; 146 last_update_time_ = current_time;
148 147
149 if (!epoch_.IsInitialized()) { 148 if (!epoch_.IsInitialized()) {
150 // First ACK after a loss event. 149 // First ACK after a loss event.
151 DLOG(INFO) << "Start of epoch"; 150 DLOG(INFO) << "Start of epoch";
152 epoch_ = current_time; // Start of epoch. 151 epoch_ = current_time; // Start of epoch.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Compute target congestion_window based on cubic target and estimated TCP 189 // Compute target congestion_window based on cubic target and estimated TCP
191 // congestion_window, use highest (fastest). 190 // congestion_window, use highest (fastest).
192 if (target_congestion_window < estimated_tcp_congestion_window_) { 191 if (target_congestion_window < estimated_tcp_congestion_window_) {
193 target_congestion_window = estimated_tcp_congestion_window_; 192 target_congestion_window = estimated_tcp_congestion_window_;
194 } 193 }
195 DLOG(INFO) << "Target congestion_window:" << target_congestion_window; 194 DLOG(INFO) << "Target congestion_window:" << target_congestion_window;
196 return target_congestion_window; 195 return target_congestion_window;
197 } 196 }
198 197
199 } // namespace net 198 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/fix_rate_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698