| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 313 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); |
| 314 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin(); | 314 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin(); |
| 315 it != unacked_packets_.end(); ++it, ++packet_number) { | 315 it != unacked_packets_.end(); ++it, ++packet_number) { |
| 316 if (packet_number > ack_frame.largest_observed) { | 316 if (packet_number > ack_frame.largest_observed) { |
| 317 // These packets are still in flight. | 317 // These packets are still in flight. |
| 318 break; | 318 break; |
| 319 } | 319 } |
| 320 | 320 |
| 321 if ((ack_frame.missing && ack_frame.packets.Contains(packet_number)) || | 321 if ((ack_frame.missing && ack_frame.packets.Contains(packet_number)) || |
| 322 (!ack_frame.missing && !ack_frame.packets.Contains(packet_number))) { | 322 (!ack_frame.missing && !ack_frame.packets.Contains(packet_number))) { |
| 323 // Don't continue to increase the nack count for packets not in flight. | 323 // Packet is still missing. |
| 324 if (FLAGS_quic_simplify_loss_detection || !it->in_flight) { | |
| 325 continue; | |
| 326 } | |
| 327 // Consider it multiple nacks when there is a gap between the missing | |
| 328 // packet and the largest observed, since the purpose of a nack | |
| 329 // threshold is to tolerate re-ordering. This handles both StretchAcks | |
| 330 // and Forward Acks. | |
| 331 // The nack count only increases when the largest observed increases. | |
| 332 QuicPacketCount min_nacks = ack_frame.largest_observed - packet_number; | |
| 333 // Truncated acks can nack the largest observed, so use a min of 1. | |
| 334 if (min_nacks == 0) { | |
| 335 min_nacks = 1; | |
| 336 } | |
| 337 unacked_packets_.NackPacket(packet_number, min_nacks); | |
| 338 continue; | 324 continue; |
| 339 } | 325 } |
| 340 // Packet was acked, so remove it from our unacked packet list. | 326 // Packet was acked, so remove it from our unacked packet list. |
| 341 DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number; | 327 DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number; |
| 342 // If data is associated with the most recent transmission of this | 328 // If data is associated with the most recent transmission of this |
| 343 // packet, then inform the caller. | 329 // packet, then inform the caller. |
| 344 if (it->in_flight) { | 330 if (it->in_flight) { |
| 345 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent)); | 331 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent)); |
| 346 } else if (FLAGS_quic_loss_recovery_use_largest_acked && | 332 } else if (FLAGS_quic_loss_recovery_use_largest_acked && |
| 347 !it->is_unackable) { | 333 !it->is_unackable) { |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 1009 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( |
| 1024 QuicPacketNumber packet_number) { | 1010 QuicPacketNumber packet_number) { |
| 1025 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 1011 return unacked_packets_.GetMutableTransmissionInfo(packet_number); |
| 1026 } | 1012 } |
| 1027 | 1013 |
| 1028 void QuicSentPacketManager::RemoveObsoletePackets() { | 1014 void QuicSentPacketManager::RemoveObsoletePackets() { |
| 1029 unacked_packets_.RemoveObsoletePackets(); | 1015 unacked_packets_.RemoveObsoletePackets(); |
| 1030 } | 1016 } |
| 1031 | 1017 |
| 1032 } // namespace net | 1018 } // namespace net |
| OLD | NEW |