OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ | 5 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ |
6 #define NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ | 6 #define NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "net/quic/congestion_control/loss_detection_interface.h" | 12 #include "net/quic/congestion_control/loss_detection_interface.h" |
13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
14 #include "net/quic/quic_time.h" | 14 #include "net/quic/quic_time.h" |
15 #include "net/quic/quic_unacked_packet_map.h" | 15 #include "net/quic/quic_unacked_packet_map.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 // Class which implement's TCP's approach of detecting loss when 3 nacks have | 19 // Class which implement's TCP's approach of detecting loss when 3 nacks have |
20 // been received for a packet. Also implements TCP's early retransmit(RFC5827). | 20 // been received for a packet. Also implements TCP's early retransmit(RFC5827). |
21 class NET_EXPORT_PRIVATE TCPLossAlgorithm : public LossDetectionInterface { | 21 class NET_EXPORT_PRIVATE TCPLossAlgorithm : public LossDetectionInterface { |
22 public: | 22 public: |
| 23 // TCP retransmits after 3 nacks. |
| 24 static const size_t kNumberOfNacksBeforeRetransmission = 3; |
| 25 |
23 TCPLossAlgorithm(); | 26 TCPLossAlgorithm(); |
24 ~TCPLossAlgorithm() override {} | 27 ~TCPLossAlgorithm() override {} |
25 | 28 |
26 LossDetectionType GetLossDetectionType() const override; | 29 LossDetectionType GetLossDetectionType() const override; |
27 | 30 |
28 // Uses nack counts to decide when packets are lost. | 31 // Uses nack counts to decide when packets are lost. |
29 SequenceNumberSet DetectLostPackets( | 32 SequenceNumberSet DetectLostPackets( |
30 const QuicUnackedPacketMap& unacked_packets, | 33 const QuicUnackedPacketMap& unacked_packets, |
31 const QuicTime& time, | 34 const QuicTime& time, |
32 QuicPacketSequenceNumber largest_observed, | 35 QuicPacketSequenceNumber largest_observed, |
33 const RttStats& rtt_stats) override; | 36 const RttStats& rtt_stats) override; |
34 | 37 |
35 // Returns a non-zero value when the early retransmit timer is active. | 38 // Returns a non-zero value when the early retransmit timer is active. |
36 QuicTime GetLossTimeout() const override; | 39 QuicTime GetLossTimeout() const override; |
37 | 40 |
38 private: | 41 private: |
39 QuicTime loss_detection_timeout_; | 42 QuicTime loss_detection_timeout_; |
40 | 43 |
41 DISALLOW_COPY_AND_ASSIGN(TCPLossAlgorithm); | 44 DISALLOW_COPY_AND_ASSIGN(TCPLossAlgorithm); |
42 }; | 45 }; |
43 | 46 |
44 } // namespace net | 47 } // namespace net |
45 | 48 |
46 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ | 49 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_ |
OLD | NEW |