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/send_algorithm_interface.h" | 5 #include "net/quic/congestion_control/send_algorithm_interface.h" |
6 | 6 |
7 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" | 7 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" |
8 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 8 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
| 9 #include "net/quic/quic_flags.h" |
9 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 class RttStats; | 14 class RttStats; |
14 | 15 |
15 // Factory for send side congestion control algorithm. | 16 // Factory for send side congestion control algorithm. |
16 SendAlgorithmInterface* SendAlgorithmInterface::Create( | 17 SendAlgorithmInterface* SendAlgorithmInterface::Create( |
17 const QuicClock* clock, | 18 const QuicClock* clock, |
18 const RttStats* rtt_stats, | 19 const RttStats* rtt_stats, |
19 CongestionControlType congestion_control_type, | 20 CongestionControlType congestion_control_type, |
20 QuicConnectionStats* stats, | 21 QuicConnectionStats* stats, |
21 QuicPacketCount initial_congestion_window) { | 22 QuicPacketCount initial_congestion_window) { |
| 23 const QuicPacketCount max_congestion_window = |
| 24 FLAGS_quic_limit_max_cwnd_to_receive_buffer |
| 25 ? (kDefaultSocketReceiveBuffer * kUsableRecieveBufferFraction) / |
| 26 kDefaultTCPMSS |
| 27 : kMaxTcpCongestionWindow; |
22 switch (congestion_control_type) { | 28 switch (congestion_control_type) { |
23 case kCubic: | 29 case kCubic: |
24 return new TcpCubicSender(clock, rtt_stats, false /* don't use Reno */, | 30 return new TcpCubicSender(clock, rtt_stats, false /* don't use Reno */, |
25 initial_congestion_window, | 31 initial_congestion_window, |
26 kMaxTcpCongestionWindow, stats); | 32 max_congestion_window, stats); |
27 case kCubicBytes: | 33 case kCubicBytes: |
28 return new TcpCubicBytesSender( | 34 return new TcpCubicBytesSender( |
29 clock, rtt_stats, false /* don't use Reno */, | 35 clock, rtt_stats, false /* don't use Reno */, |
30 initial_congestion_window, kMaxTcpCongestionWindow, stats); | 36 initial_congestion_window, max_congestion_window, stats); |
31 case kReno: | 37 case kReno: |
32 return new TcpCubicSender(clock, rtt_stats, true /* use Reno */, | 38 return new TcpCubicSender(clock, rtt_stats, true /* use Reno */, |
33 initial_congestion_window, | 39 initial_congestion_window, |
34 kMaxTcpCongestionWindow, stats); | 40 max_congestion_window, stats); |
35 case kRenoBytes: | 41 case kRenoBytes: |
36 return new TcpCubicBytesSender(clock, rtt_stats, true /* use Reno */, | 42 return new TcpCubicBytesSender(clock, rtt_stats, true /* use Reno */, |
37 initial_congestion_window, | 43 initial_congestion_window, |
38 kMaxTcpCongestionWindow, stats); | 44 max_congestion_window, stats); |
39 case kBBR: | 45 case kBBR: |
40 // TODO(rtenneti): Enable BbrTcpSender. | 46 // TODO(rtenneti): Enable BbrTcpSender. |
41 #if 0 | 47 #if 0 |
42 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, | 48 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, |
43 kMaxTcpCongestionWindow, stats); | 49 max_congestion_window, stats); |
44 #endif | 50 #endif |
45 LOG(DFATAL) << "BbrTcpSender is not supported."; | 51 LOG(DFATAL) << "BbrTcpSender is not supported."; |
46 return nullptr; | 52 return nullptr; |
47 } | 53 } |
48 return nullptr; | 54 return nullptr; |
49 } | 55 } |
50 | 56 |
51 } // namespace net | 57 } // namespace net |
OLD | NEW |