OLD | NEW |
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. |
(...skipping 30 matching lines...) Expand all Loading... |
51 previous_slowstart_threshold_(0), | 52 previous_slowstart_threshold_(0), |
52 last_cutback_exited_slowstart_(false), | 53 last_cutback_exited_slowstart_(false), |
53 max_tcp_congestion_window_(max_tcp_congestion_window) { | 54 max_tcp_congestion_window_(max_tcp_congestion_window) { |
54 } | 55 } |
55 | 56 |
56 TcpCubicSender::~TcpCubicSender() { | 57 TcpCubicSender::~TcpCubicSender() { |
57 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); | 58 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); |
58 } | 59 } |
59 | 60 |
60 void TcpCubicSender::SetFromConfig(const QuicConfig& config, bool is_server) { | 61 void TcpCubicSender::SetFromConfig(const QuicConfig& config, bool is_server) { |
61 if (is_server && config.HasReceivedInitialCongestionWindow()) { | 62 if (is_server) { |
62 // Set the initial window size. | 63 if (config.HasReceivedConnectionOptions() && |
63 congestion_window_ = min(kMaxInitialWindow, | 64 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW10)) { |
64 config.ReceivedInitialCongestionWindow()); | 65 // Initial window experiment. Ignore the initial congestion |
| 66 // window suggested by the client and use the default ICWND of |
| 67 // 10 instead. |
| 68 congestion_window_ = kInitialCongestionWindow; |
| 69 } else if (config.HasReceivedInitialCongestionWindow()) { |
| 70 // Set the initial window size. |
| 71 congestion_window_ = min(kMaxInitialWindow, |
| 72 config.ReceivedInitialCongestionWindow()); |
| 73 } |
65 } | 74 } |
66 } | 75 } |
67 | 76 |
68 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame( | 77 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame( |
69 const QuicCongestionFeedbackFrame& feedback, | 78 const QuicCongestionFeedbackFrame& feedback, |
70 QuicTime feedback_receive_time) { | 79 QuicTime feedback_receive_time) { |
71 if (feedback.type == kTCP) { | 80 if (feedback.type == kTCP) { |
72 receive_window_ = feedback.tcp.receive_window; | 81 receive_window_ = feedback.tcp.receive_window; |
73 } | 82 } |
74 } | 83 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return QuicTime::Delta::Zero(); | 354 return QuicTime::Delta::Zero(); |
346 } | 355 } |
347 return QuicTime::Delta::Infinite(); | 356 return QuicTime::Delta::Infinite(); |
348 } | 357 } |
349 | 358 |
350 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 359 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
351 return reno_ ? kReno : kCubic; | 360 return reno_ ? kReno : kCubic; |
352 } | 361 } |
353 | 362 |
354 } // namespace net | 363 } // namespace net |
OLD | NEW |