| 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_TIME_LOSS_ALGORITHM_H_ | 5 #ifndef NET_QUIC_CONGESTION_CONTROL_TIME_LOSS_ALGORITHM_H_ |
| 6 #define NET_QUIC_CONGESTION_CONTROL_TIME_LOSS_ALGORITHM_H_ | 6 #define NET_QUIC_CONGESTION_CONTROL_TIME_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 // A loss detection algorithm which avoids spurious losses and retransmissions | 19 // A loss detection algorithm which avoids spurious losses and retransmissions |
| 20 // by waiting 1.25 RTTs after a packet was sent instead of nack count. | 20 // by waiting 1.25 RTTs after a packet was sent instead of nack count. |
| 21 class NET_EXPORT_PRIVATE TimeLossAlgorithm : public LossDetectionInterface { | 21 class NET_EXPORT_PRIVATE TimeLossAlgorithm : public LossDetectionInterface { |
| 22 public: | 22 public: |
| 23 TimeLossAlgorithm(); | 23 TimeLossAlgorithm(); |
| 24 virtual ~TimeLossAlgorithm() {} | 24 virtual ~TimeLossAlgorithm() {} |
| 25 | 25 |
| 26 virtual LossDetectionType GetLossDetectionType() const OVERRIDE; | 26 virtual LossDetectionType GetLossDetectionType() const override; |
| 27 | 27 |
| 28 // Declares pending packets less than the largest observed lost when it has | 28 // Declares pending packets less than the largest observed lost when it has |
| 29 // been 1.25 RTT since they were sent. Packets larger than the largest | 29 // been 1.25 RTT since they were sent. Packets larger than the largest |
| 30 // observed are retransmitted via TLP. | 30 // observed are retransmitted via TLP. |
| 31 virtual SequenceNumberSet DetectLostPackets( | 31 virtual SequenceNumberSet DetectLostPackets( |
| 32 const QuicUnackedPacketMap& unacked_packets, | 32 const QuicUnackedPacketMap& unacked_packets, |
| 33 const QuicTime& time, | 33 const QuicTime& time, |
| 34 QuicPacketSequenceNumber largest_observed, | 34 QuicPacketSequenceNumber largest_observed, |
| 35 const RttStats& rtt_stats) OVERRIDE; | 35 const RttStats& rtt_stats) override; |
| 36 | 36 |
| 37 // Returns the time the next packet will be lost, or zero if there | 37 // Returns the time the next packet will be lost, or zero if there |
| 38 // are no nacked pending packets outstanding. | 38 // are no nacked pending packets outstanding. |
| 39 // TODO(ianswett): Ideally the RTT variance and the RTT would be used to | 39 // TODO(ianswett): Ideally the RTT variance and the RTT would be used to |
| 40 // determine the time a packet is considered lost. | 40 // determine the time a packet is considered lost. |
| 41 // TODO(ianswett): Consider using Max(1.25 * srtt, 1.125 * last_rtt). | 41 // TODO(ianswett): Consider using Max(1.25 * srtt, 1.125 * last_rtt). |
| 42 virtual QuicTime GetLossTimeout() const OVERRIDE; | 42 virtual QuicTime GetLossTimeout() const override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 QuicTime loss_detection_timeout_; | 45 QuicTime loss_detection_timeout_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(TimeLossAlgorithm); | 47 DISALLOW_COPY_AND_ASSIGN(TimeLossAlgorithm); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace net | 50 } // namespace net |
| 51 | 51 |
| 52 #endif // NET_QUIC_CONGESTION_CONTROL_TIME_LOSS_ALGORITHM_H_ | 52 #endif // NET_QUIC_CONGESTION_CONTROL_TIME_LOSS_ALGORITHM_H_ |
| OLD | NEW |