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
3 // found in the LICENSE file.
5 #include "net/quic/congestion_control/send_algorithm_interface.h"
7 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h"
8 #include "net/quic/congestion_control/tcp_cubic_sender.h"
9 #include "net/quic/quic_protocol.h"
15 // Factory for send side congestion control algorithm.
16 SendAlgorithmInterface
* SendAlgorithmInterface::Create(
17 const QuicClock
* clock
,
18 const RttStats
* rtt_stats
,
19 CongestionControlType congestion_control_type
,
20 QuicConnectionStats
* stats
,
21 QuicPacketCount initial_congestion_window
) {
22 const QuicPacketCount max_congestion_window
=
23 (kDefaultSocketReceiveBuffer
* kConservativeReceiveBufferFraction
) /
25 switch (congestion_control_type
) {
27 return new TcpCubicSender(clock
, rtt_stats
, false /* don't use Reno */,
28 initial_congestion_window
,
29 max_congestion_window
, stats
);
31 return new TcpCubicBytesSender(
32 clock
, rtt_stats
, false /* don't use Reno */,
33 initial_congestion_window
, max_congestion_window
, stats
);
35 return new TcpCubicSender(clock
, rtt_stats
, true /* use Reno */,
36 initial_congestion_window
,
37 max_congestion_window
, stats
);
39 return new TcpCubicBytesSender(clock
, rtt_stats
, true /* use Reno */,
40 initial_congestion_window
,
41 max_congestion_window
, stats
);
43 // TODO(rtenneti): Enable BbrTcpSender.
45 return new BbrTcpSender(clock
, rtt_stats
, initial_congestion_window
,
46 max_congestion_window
, stats
, true);
48 LOG(DFATAL
) << "BbrTcpSender is not supported.";