| 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 #include "net/quic/congestion_control/time_loss_algorithm.h" | 5 #include "net/quic/congestion_control/time_loss_algorithm.h" |
| 6 | 6 |
| 7 #include "net/quic/congestion_control/rtt_stats.h" | 7 #include "net/quic/congestion_control/rtt_stats.h" |
| 8 #include "net/quic/quic_protocol.h" | 8 #include "net/quic/quic_protocol.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 SequenceNumberSet TimeLossAlgorithm::DetectLostPackets( | 30 SequenceNumberSet TimeLossAlgorithm::DetectLostPackets( |
| 31 const QuicUnackedPacketMap& unacked_packets, | 31 const QuicUnackedPacketMap& unacked_packets, |
| 32 const QuicTime& time, | 32 const QuicTime& time, |
| 33 QuicPacketSequenceNumber largest_observed, | 33 QuicPacketSequenceNumber largest_observed, |
| 34 const RttStats& rtt_stats) { | 34 const RttStats& rtt_stats) { |
| 35 SequenceNumberSet lost_packets; | 35 SequenceNumberSet lost_packets; |
| 36 loss_detection_timeout_ = QuicTime::Zero(); | 36 loss_detection_timeout_ = QuicTime::Zero(); |
| 37 QuicTime::Delta loss_delay = QuicTime::Delta::Max( | 37 QuicTime::Delta loss_delay = QuicTime::Delta::Max( |
| 38 QuicTime::Delta::FromMilliseconds(kMinLossDelayMs), | 38 QuicTime::Delta::FromMilliseconds(kMinLossDelayMs), |
| 39 QuicTime::Delta::Max(rtt_stats.SmoothedRtt(), rtt_stats.latest_rtt()) | 39 QuicTime::Delta::Max(rtt_stats.smoothed_rtt(), rtt_stats.latest_rtt()) |
| 40 .Multiply(kLossDelayMultiplier)); | 40 .Multiply(kLossDelayMultiplier)); |
| 41 | 41 |
| 42 QuicPacketSequenceNumber sequence_number = unacked_packets.GetLeastUnacked(); | 42 QuicPacketSequenceNumber sequence_number = unacked_packets.GetLeastUnacked(); |
| 43 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); | 43 for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin(); |
| 44 it != unacked_packets.end() && sequence_number <= largest_observed; | 44 it != unacked_packets.end() && sequence_number <= largest_observed; |
| 45 ++it, ++sequence_number) { | 45 ++it, ++sequence_number) { |
| 46 if (!it->in_flight) { | 46 if (!it->in_flight) { |
| 47 continue; | 47 continue; |
| 48 } | 48 } |
| 49 LOG_IF(DFATAL, it->nack_count == 0) | 49 LOG_IF(DFATAL, it->nack_count == 0) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 62 return lost_packets; | 62 return lost_packets; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // loss_time_ is updated in DetectLostPackets, which must be called every time | 65 // loss_time_ is updated in DetectLostPackets, which must be called every time |
| 66 // an ack is received or the timeout expires. | 66 // an ack is received or the timeout expires. |
| 67 QuicTime TimeLossAlgorithm::GetLossTimeout() const { | 67 QuicTime TimeLossAlgorithm::GetLossTimeout() const { |
| 68 return loss_detection_timeout_; | 68 return loss_detection_timeout_; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace net | 71 } // namespace net |
| OLD | NEW |