OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 288 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); |
289 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin(); | 289 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin(); |
290 it != unacked_packets_.end(); ++it, ++packet_number) { | 290 it != unacked_packets_.end(); ++it, ++packet_number) { |
291 if (packet_number > ack_frame.largest_observed) { | 291 if (packet_number > ack_frame.largest_observed) { |
292 // These packets are still in flight. | 292 // These packets are still in flight. |
293 break; | 293 break; |
294 } | 294 } |
295 | 295 |
296 if (ack_frame.missing_packets.Contains(packet_number)) { | 296 if (ack_frame.missing_packets.Contains(packet_number)) { |
297 // Don't continue to increase the nack count for packets not in flight. | 297 // Don't continue to increase the nack count for packets not in flight. |
298 if (!it->in_flight) { | 298 if (FLAGS_quic_simplify_loss_detection || !it->in_flight) { |
299 continue; | 299 continue; |
300 } | 300 } |
301 // Consider it multiple nacks when there is a gap between the missing | 301 // Consider it multiple nacks when there is a gap between the missing |
302 // packet and the largest observed, since the purpose of a nack | 302 // packet and the largest observed, since the purpose of a nack |
303 // threshold is to tolerate re-ordering. This handles both StretchAcks | 303 // threshold is to tolerate re-ordering. This handles both StretchAcks |
304 // and Forward Acks. | 304 // and Forward Acks. |
305 // The nack count only increases when the largest observed increases. | 305 // The nack count only increases when the largest observed increases. |
306 QuicPacketCount min_nacks = ack_frame.largest_observed - packet_number; | 306 QuicPacketCount min_nacks = ack_frame.largest_observed - packet_number; |
307 // Truncated acks can nack the largest observed, so use a min of 1. | 307 // Truncated acks can nack the largest observed, so use a min of 1. |
308 if (min_nacks == 0) { | 308 if (min_nacks == 0) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 433 } |
434 } | 434 } |
435 DCHECK(unacked_packets_.IsUnacked(packet_number)) << packet_number; | 435 DCHECK(unacked_packets_.IsUnacked(packet_number)) << packet_number; |
436 const TransmissionInfo& transmission_info = | 436 const TransmissionInfo& transmission_info = |
437 unacked_packets_.GetTransmissionInfo(packet_number); | 437 unacked_packets_.GetTransmissionInfo(packet_number); |
438 DCHECK(!transmission_info.retransmittable_frames.empty()); | 438 DCHECK(!transmission_info.retransmittable_frames.empty()); |
439 | 439 |
440 return PendingRetransmission(path_id_, packet_number, transmission_type, | 440 return PendingRetransmission(path_id_, packet_number, transmission_type, |
441 transmission_info.retransmittable_frames, | 441 transmission_info.retransmittable_frames, |
442 transmission_info.has_crypto_handshake, | 442 transmission_info.has_crypto_handshake, |
443 transmission_info.needs_padding, | 443 transmission_info.num_padding_bytes, |
444 transmission_info.encryption_level, | 444 transmission_info.encryption_level, |
445 transmission_info.packet_number_length); | 445 transmission_info.packet_number_length); |
446 } | 446 } |
447 | 447 |
448 QuicPacketNumber QuicSentPacketManager::GetNewestRetransmission( | 448 QuicPacketNumber QuicSentPacketManager::GetNewestRetransmission( |
449 QuicPacketNumber packet_number, | 449 QuicPacketNumber packet_number, |
450 const TransmissionInfo& transmission_info) const { | 450 const TransmissionInfo& transmission_info) const { |
451 QuicPacketNumber retransmission = transmission_info.retransmission; | 451 QuicPacketNumber retransmission = transmission_info.retransmission; |
452 while (retransmission != 0) { | 452 while (retransmission != 0) { |
453 packet_number = retransmission; | 453 packet_number = retransmission; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 956 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( |
957 QuicPacketNumber packet_number) { | 957 QuicPacketNumber packet_number) { |
958 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 958 return unacked_packets_.GetMutableTransmissionInfo(packet_number); |
959 } | 959 } |
960 | 960 |
961 void QuicSentPacketManager::RemoveObsoletePackets() { | 961 void QuicSentPacketManager::RemoveObsoletePackets() { |
962 unacked_packets_.RemoveObsoletePackets(); | 962 unacked_packets_.RemoveObsoletePackets(); |
963 } | 963 } |
964 | 964 |
965 } // namespace net | 965 } // namespace net |
OLD | NEW |