| 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 // TCP cubic send side congestion algorithm, emulates the behavior of | 5 // TCP cubic send side congestion algorithm, emulates the behavior of |
| 6 // TCP cubic. | 6 // TCP cubic. |
| 7 | 7 |
| 8 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 8 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
| 9 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 9 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 #include "net/quic/congestion_control/cubic.h" | 14 #include "net/quic/congestion_control/cubic.h" |
| 15 #include "net/quic/congestion_control/hybrid_slow_start.h" | 15 #include "net/quic/congestion_control/hybrid_slow_start.h" |
| 16 #include "net/quic/congestion_control/prr_sender.h" | 16 #include "net/quic/congestion_control/prr_sender.h" |
| 17 #include "net/quic/congestion_control/send_algorithm_interface.h" | 17 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 18 #include "net/quic/crypto/cached_network_parameters.h" |
| 18 #include "net/quic/quic_bandwidth.h" | 19 #include "net/quic/quic_bandwidth.h" |
| 19 #include "net/quic/quic_connection_stats.h" | 20 #include "net/quic/quic_connection_stats.h" |
| 20 #include "net/quic/quic_protocol.h" | 21 #include "net/quic/quic_protocol.h" |
| 21 #include "net/quic/quic_time.h" | 22 #include "net/quic/quic_time.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class RttStats; | 26 class RttStats; |
| 26 | 27 |
| 27 namespace test { | 28 namespace test { |
| 28 class TcpCubicSenderPeer; | 29 class TcpCubicSenderPeer; |
| 29 } // namespace test | 30 } // namespace test |
| 30 | 31 |
| 31 class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface { | 32 class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface { |
| 32 public: | 33 public: |
| 33 // Reno option and max_tcp_congestion_window are provided for testing. | 34 // Reno option and max_tcp_congestion_window are provided for testing. |
| 34 TcpCubicSender(const QuicClock* clock, | 35 TcpCubicSender(const QuicClock* clock, |
| 35 const RttStats* rtt_stats, | 36 const RttStats* rtt_stats, |
| 36 bool reno, | 37 bool reno, |
| 37 QuicPacketCount initial_tcp_congestion_window, | 38 QuicPacketCount initial_tcp_congestion_window, |
| 38 QuicPacketCount max_tcp_congestion_window, | 39 QuicPacketCount max_tcp_congestion_window, |
| 39 QuicConnectionStats* stats); | 40 QuicConnectionStats* stats); |
| 40 ~TcpCubicSender() override; | 41 ~TcpCubicSender() override; |
| 41 | 42 |
| 42 // Start implementation of SendAlgorithmInterface. | 43 // Start implementation of SendAlgorithmInterface. |
| 43 void SetFromConfig(const QuicConfig& config, | 44 void SetFromConfig(const QuicConfig& config, |
| 44 bool is_server, | 45 bool is_server, |
| 45 bool using_pacing) override; | 46 bool using_pacing) override; |
| 47 void ResumeConnectionState( |
| 48 const CachedNetworkParameters& cached_network_params) override; |
| 46 void SetNumEmulatedConnections(int num_connections) override; | 49 void SetNumEmulatedConnections(int num_connections) override; |
| 47 void OnCongestionEvent(bool rtt_updated, | 50 void OnCongestionEvent(bool rtt_updated, |
| 48 QuicByteCount bytes_in_flight, | 51 QuicByteCount bytes_in_flight, |
| 49 const CongestionVector& acked_packets, | 52 const CongestionVector& acked_packets, |
| 50 const CongestionVector& lost_packets) override; | 53 const CongestionVector& lost_packets) override; |
| 51 bool OnPacketSent(QuicTime sent_time, | 54 bool OnPacketSent(QuicTime sent_time, |
| 52 QuicByteCount bytes_in_flight, | 55 QuicByteCount bytes_in_flight, |
| 53 QuicPacketSequenceNumber sequence_number, | 56 QuicPacketSequenceNumber sequence_number, |
| 54 QuicByteCount bytes, | 57 QuicByteCount bytes, |
| 55 HasRetransmittableData is_retransmittable) override; | 58 HasRetransmittableData is_retransmittable) override; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Slow start threshold before the last loss event or RTO. | 126 // Slow start threshold before the last loss event or RTO. |
| 124 QuicPacketCount previous_slowstart_threshold_; | 127 QuicPacketCount previous_slowstart_threshold_; |
| 125 | 128 |
| 126 // Whether the last loss event caused us to exit slowstart. | 129 // Whether the last loss event caused us to exit slowstart. |
| 127 // Used for stats collection of slowstart_packets_lost | 130 // Used for stats collection of slowstart_packets_lost |
| 128 bool last_cutback_exited_slowstart_; | 131 bool last_cutback_exited_slowstart_; |
| 129 | 132 |
| 130 // Maximum number of outstanding packets for tcp. | 133 // Maximum number of outstanding packets for tcp. |
| 131 QuicPacketCount max_tcp_congestion_window_; | 134 QuicPacketCount max_tcp_congestion_window_; |
| 132 | 135 |
| 136 const QuicClock* clock_; |
| 137 |
| 133 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); | 138 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); |
| 134 }; | 139 }; |
| 135 | 140 |
| 136 } // namespace net | 141 } // namespace net |
| 137 | 142 |
| 138 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 143 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
| OLD | NEW |