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

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

Issue 447093004: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed indenation in QuicFramer.cc Created 6 years, 4 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
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/rtt_stats.h" 10 #include "net/quic/congestion_control/rtt_stats.h"
11 #include "net/quic/crypto/crypto_protocol.h"
11 12
12 using std::max; 13 using std::max;
13 using std::min; 14 using std::min;
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 // Constants based on TCP defaults. 19 // Constants based on TCP defaults.
19 // The minimum cwnd based on RFC 3782 (TCP NewReno) for cwnd reductions on a 20 // The minimum cwnd based on RFC 3782 (TCP NewReno) for cwnd reductions on a
20 // fast retransmission. The cwnd after a timeout is still 1. 21 // fast retransmission. The cwnd after a timeout is still 1.
21 const QuicTcpCongestionWindow kMinimumCongestionWindow = 2; 22 const QuicTcpCongestionWindow kMinimumCongestionWindow = 2;
22 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS; 23 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS;
23 const QuicByteCount kDefaultReceiveWindow = 64000;
24 const int64 kInitialCongestionWindow = 10; 24 const int64 kInitialCongestionWindow = 10;
25 const int kMaxBurstLength = 3; 25 const int kMaxBurstLength = 3;
26 }; // namespace 26 }; // namespace
27 27
28 TcpCubicSender::TcpCubicSender( 28 TcpCubicSender::TcpCubicSender(
29 const QuicClock* clock, 29 const QuicClock* clock,
30 const RttStats* rtt_stats, 30 const RttStats* rtt_stats,
31 bool reno, 31 bool reno,
32 QuicTcpCongestionWindow max_tcp_congestion_window, 32 QuicTcpCongestionWindow max_tcp_congestion_window,
33 QuicConnectionStats* stats) 33 QuicConnectionStats* stats)
34 : hybrid_slow_start_(clock), 34 : hybrid_slow_start_(clock),
35 cubic_(clock, stats), 35 cubic_(clock, stats),
36 rtt_stats_(rtt_stats), 36 rtt_stats_(rtt_stats),
37 stats_(stats), 37 stats_(stats),
38 reno_(reno), 38 reno_(reno),
39 congestion_window_count_(0), 39 congestion_window_count_(0),
40 receive_window_(kDefaultReceiveWindow), 40 receive_window_(kDefaultSocketReceiveBuffer),
41 prr_out_(0), 41 prr_out_(0),
42 prr_delivered_(0), 42 prr_delivered_(0),
43 ack_count_since_loss_(0), 43 ack_count_since_loss_(0),
44 bytes_in_flight_before_loss_(0), 44 bytes_in_flight_before_loss_(0),
45 largest_sent_sequence_number_(0), 45 largest_sent_sequence_number_(0),
46 largest_acked_sequence_number_(0), 46 largest_acked_sequence_number_(0),
47 largest_sent_at_last_cutback_(0), 47 largest_sent_at_last_cutback_(0),
48 congestion_window_(kInitialCongestionWindow), 48 congestion_window_(kInitialCongestionWindow),
49 previous_congestion_window_(0), 49 previous_congestion_window_(0),
50 slowstart_threshold_(max_tcp_congestion_window), 50 slowstart_threshold_(max_tcp_congestion_window),
51 previous_slowstart_threshold_(0), 51 previous_slowstart_threshold_(0),
52 last_cutback_exited_slowstart_(false), 52 last_cutback_exited_slowstart_(false),
53 max_tcp_congestion_window_(max_tcp_congestion_window) { 53 max_tcp_congestion_window_(max_tcp_congestion_window) {
54 } 54 }
55 55
56 TcpCubicSender::~TcpCubicSender() { 56 TcpCubicSender::~TcpCubicSender() {
57 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); 57 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_);
58 } 58 }
59 59
60 void TcpCubicSender::SetFromConfig(const QuicConfig& config, bool is_server) { 60 void TcpCubicSender::SetFromConfig(const QuicConfig& config, bool is_server) {
61 if (is_server && config.HasReceivedInitialCongestionWindow()) { 61 if (is_server) {
62 // Set the initial window size. 62 if (config.HasReceivedConnectionOptions() &&
63 congestion_window_ = min(kMaxInitialWindow, 63 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) {
64 config.ReceivedInitialCongestionWindow()); 64 // Initial window experiment. Ignore the initial congestion
65 // window suggested by the client and use the default ICWND of
66 // 10 instead.
67 congestion_window_ = kInitialCongestionWindow;
68 } else if (config.HasReceivedInitialCongestionWindow()) {
69 // Set the initial window size.
70 congestion_window_ = min(kMaxInitialWindow,
71 config.ReceivedInitialCongestionWindow());
72 }
73 }
74 if (config.HasReceivedSocketReceiveBuffer()) {
75 // Set the initial socket receive buffer size in bytes.
76 receive_window_ = config.ReceivedSocketReceiveBuffer();
65 } 77 }
66 } 78 }
67 79
68 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame( 80 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame(
69 const QuicCongestionFeedbackFrame& feedback, 81 const QuicCongestionFeedbackFrame& feedback,
70 QuicTime feedback_receive_time) { 82 QuicTime feedback_receive_time) {
71 receive_window_ = feedback.tcp.receive_window; 83 if (feedback.type == kTCP) {
84 receive_window_ = feedback.tcp.receive_window;
85 }
72 } 86 }
73 87
74 void TcpCubicSender::OnCongestionEvent( 88 void TcpCubicSender::OnCongestionEvent(
75 bool rtt_updated, 89 bool rtt_updated,
76 QuicByteCount bytes_in_flight, 90 QuicByteCount bytes_in_flight,
77 const CongestionMap& acked_packets, 91 const CongestionMap& acked_packets,
78 const CongestionMap& lost_packets) { 92 const CongestionMap& lost_packets) {
79 if (rtt_updated && InSlowStart() && 93 if (rtt_updated && InSlowStart() &&
80 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(), 94 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(),
81 rtt_stats_->min_rtt(), 95 rtt_stats_->min_rtt(),
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return QuicTime::Delta::Zero(); 357 return QuicTime::Delta::Zero();
344 } 358 }
345 return QuicTime::Delta::Infinite(); 359 return QuicTime::Delta::Infinite();
346 } 360 }
347 361
348 CongestionControlType TcpCubicSender::GetCongestionControlType() const { 362 CongestionControlType TcpCubicSender::GetCongestionControlType() const {
349 return reno_ ? kReno : kCubic; 363 return reno_ ? kReno : kCubic;
350 } 364 }
351 365
352 } // namespace net 366 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/send_algorithm_simulator.cc ('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