| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/quic/congestion_control/tcp_loss_algorithm.h" | 5 #include "net/quic/congestion_control/tcp_loss_algorithm.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_protocol.h" | 7 #include "net/quic/quic_protocol.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 // TCP retransmits after 3 nacks. | 12 // TCP retransmits after 3 nacks. |
| 13 static const size_t kNumberOfNacksBeforeRetransmission = 3; | 13 static const size_t kNumberOfNacksBeforeRetransmission = 3; |
| 14 } | 14 } |
| 15 | 15 |
| 16 TCPLossAlgorithm::TCPLossAlgorithm() { } | 16 TCPLossAlgorithm::TCPLossAlgorithm() { } |
| 17 | 17 |
| 18 // Uses nack counts to decide when packets are lost. | 18 // Uses nack counts to decide when packets are lost. |
| 19 SequenceNumberSet TCPLossAlgorithm::DetectLostPackets( | 19 SequenceNumberSet TCPLossAlgorithm::DetectLostPackets( |
| 20 const QuicUnackedPacketMap& unacked_packets, | 20 const QuicUnackedPacketMap& unacked_packets, |
| 21 const QuicTime& time, | 21 const QuicTime& time, |
| 22 QuicPacketSequenceNumber largest_observed, | 22 QuicPacketSequenceNumber largest_observed, |
| 23 QuicTime::Delta srtt) { | 23 QuicTime::Delta srtt, |
| 24 QuicTime::Delta latest_rtt) { |
| 24 SequenceNumberSet lost_packets; | 25 SequenceNumberSet lost_packets; |
| 25 | 26 |
| 26 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); | 27 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); |
| 27 it != unacked_packets.end() && it->first <= largest_observed; ++it) { | 28 it != unacked_packets.end() && it->first <= largest_observed; ++it) { |
| 28 if (!it->second.pending) { | 29 if (!it->second.pending) { |
| 29 continue; | 30 continue; |
| 30 } | 31 } |
| 31 size_t num_nacks_needed = kNumberOfNacksBeforeRetransmission; | 32 size_t num_nacks_needed = kNumberOfNacksBeforeRetransmission; |
| 32 // Check for early retransmit(RFC5827) when the last packet gets acked and | 33 // Check for early retransmit(RFC5827) when the last packet gets acked and |
| 33 // the there are fewer than 4 pending packets. | 34 // the there are fewer than 4 pending packets. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 46 } | 47 } |
| 47 | 48 |
| 48 return lost_packets; | 49 return lost_packets; |
| 49 } | 50 } |
| 50 | 51 |
| 51 QuicTime TCPLossAlgorithm::GetLossTimeout() const { | 52 QuicTime TCPLossAlgorithm::GetLossTimeout() const { |
| 52 return QuicTime::Zero(); | 53 return QuicTime::Zero(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 } // namespace net | 56 } // namespace net |
| OLD | NEW |