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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Reno option and max_tcp_congestion_window are provided for testing. | 32 // Reno option and max_tcp_congestion_window are provided for testing. |
33 TcpCubicSender(const QuicClock* clock, | 33 TcpCubicSender(const QuicClock* clock, |
34 const RttStats* rtt_stats, | 34 const RttStats* rtt_stats, |
35 bool reno, | 35 bool reno, |
36 QuicTcpCongestionWindow max_tcp_congestion_window, | 36 QuicTcpCongestionWindow max_tcp_congestion_window, |
37 QuicConnectionStats* stats); | 37 QuicConnectionStats* stats); |
38 virtual ~TcpCubicSender(); | 38 virtual ~TcpCubicSender(); |
39 | 39 |
40 // Start implementation of SendAlgorithmInterface. | 40 // Start implementation of SendAlgorithmInterface. |
41 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; | 41 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; |
| 42 virtual void SetNumEmulatedConnections(int num_connections) OVERRIDE; |
42 virtual void OnIncomingQuicCongestionFeedbackFrame( | 43 virtual void OnIncomingQuicCongestionFeedbackFrame( |
43 const QuicCongestionFeedbackFrame& feedback, | 44 const QuicCongestionFeedbackFrame& feedback, |
44 QuicTime feedback_receive_time) OVERRIDE; | 45 QuicTime feedback_receive_time) OVERRIDE; |
45 virtual void OnCongestionEvent(bool rtt_updated, | 46 virtual void OnCongestionEvent(bool rtt_updated, |
46 QuicByteCount bytes_in_flight, | 47 QuicByteCount bytes_in_flight, |
47 const CongestionVector& acked_packets, | 48 const CongestionVector& acked_packets, |
48 const CongestionVector& lost_packets) OVERRIDE; | 49 const CongestionVector& lost_packets) OVERRIDE; |
49 virtual bool OnPacketSent(QuicTime sent_time, | 50 virtual bool OnPacketSent(QuicTime sent_time, |
50 QuicByteCount bytes_in_flight, | 51 QuicByteCount bytes_in_flight, |
51 QuicPacketSequenceNumber sequence_number, | 52 QuicPacketSequenceNumber sequence_number, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void PrrOnPacketLost(QuicByteCount bytes_in_flight); | 86 void PrrOnPacketLost(QuicByteCount bytes_in_flight); |
86 void PrrOnPacketAcked(QuicByteCount acked_bytes); | 87 void PrrOnPacketAcked(QuicByteCount acked_bytes); |
87 QuicTime::Delta PrrTimeUntilSend(QuicByteCount bytes_in_flight) const; | 88 QuicTime::Delta PrrTimeUntilSend(QuicByteCount bytes_in_flight) const; |
88 | 89 |
89 | 90 |
90 HybridSlowStart hybrid_slow_start_; | 91 HybridSlowStart hybrid_slow_start_; |
91 Cubic cubic_; | 92 Cubic cubic_; |
92 const RttStats* rtt_stats_; | 93 const RttStats* rtt_stats_; |
93 QuicConnectionStats* stats_; | 94 QuicConnectionStats* stats_; |
94 | 95 |
95 // Reno provided for testing. | 96 // If true, Reno congestion control is used instead of Cubic. |
96 const bool reno_; | 97 const bool reno_; |
97 | 98 |
| 99 // Number of connections to simulate. |
| 100 int num_connections_; |
| 101 |
98 // ACK counter for the Reno implementation. | 102 // ACK counter for the Reno implementation. |
99 int64 congestion_window_count_; | 103 int64 congestion_window_count_; |
100 | 104 |
101 // Receiver side advertised window. | 105 // Receiver side advertised window. |
102 QuicByteCount receive_window_; | 106 QuicByteCount receive_window_; |
103 | 107 |
104 // Bytes sent and acked since the last loss event. Used for PRR. | 108 // Bytes sent and acked since the last loss event. Used for PRR. |
105 QuicByteCount prr_out_; | 109 QuicByteCount prr_out_; |
106 QuicByteCount prr_delivered_; | 110 QuicByteCount prr_delivered_; |
107 size_t ack_count_since_loss_; | 111 size_t ack_count_since_loss_; |
(...skipping 28 matching lines...) Expand all Loading... |
136 | 140 |
137 // Maximum number of outstanding packets for tcp. | 141 // Maximum number of outstanding packets for tcp. |
138 QuicTcpCongestionWindow max_tcp_congestion_window_; | 142 QuicTcpCongestionWindow max_tcp_congestion_window_; |
139 | 143 |
140 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); | 144 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); |
141 }; | 145 }; |
142 | 146 |
143 } // namespace net | 147 } // namespace net |
144 | 148 |
145 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 149 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
OLD | NEW |