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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 while (it != unacked_packets_.end()) { | 165 while (it != unacked_packets_.end()) { |
166 QuicPacketSequenceNumber sequence_number = it->first; | 166 QuicPacketSequenceNumber sequence_number = it->first; |
167 if (sequence_number > received_info.largest_observed) { | 167 if (sequence_number > received_info.largest_observed) { |
168 // These packets are still in flight. | 168 // These packets are still in flight. |
169 break; | 169 break; |
170 } | 170 } |
171 | 171 |
172 if (IsAwaitingPacket(received_info, sequence_number)) { | 172 if (IsAwaitingPacket(received_info, sequence_number)) { |
173 // Remove any packets not being tracked by the send algorithm, allowing | 173 // Remove any packets not being tracked by the send algorithm, allowing |
174 // the high water mark to be raised if necessary. | 174 // the high water mark to be raised if necessary. |
175 if (QuicUnackedPacketMap::IsSentAndNotPending(it->second)) { | 175 if (QuicUnackedPacketMap::IsForRttOnly(it->second)) { |
176 it = MarkPacketHandled(sequence_number, delta_largest_observed); | 176 it = MarkPacketHandled(sequence_number, delta_largest_observed); |
177 } else { | 177 } else { |
178 // Consider it multiple nacks when there is a gap between the missing | 178 // Consider it multiple nacks when there is a gap between the missing |
179 // packet and the largest observed, since the purpose of a nack | 179 // packet and the largest observed, since the purpose of a nack |
180 // threshold is to tolerate re-ordering. This handles both StretchAcks | 180 // threshold is to tolerate re-ordering. This handles both StretchAcks |
181 // and Forward Acks. | 181 // and Forward Acks. |
182 // The nack count only increases when the largest observed increases. | 182 // The nack count only increases when the largest observed increases. |
183 size_t min_nacks = received_info.largest_observed - sequence_number; | 183 size_t min_nacks = received_info.largest_observed - sequence_number; |
184 // Truncated acks can nack the largest observed, so use a min of 1. | 184 // Truncated acks can nack the largest observed, so use a min of 1. |
185 if (min_nacks == 0) { | 185 if (min_nacks == 0) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 254 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
255 it != unacked_packets_.end(); ++it) { | 255 it != unacked_packets_.end(); ++it) { |
256 const RetransmittableFrames* frames = | 256 const RetransmittableFrames* frames = |
257 it->second.retransmittable_frames; | 257 it->second.retransmittable_frames; |
258 if (frames != NULL && frames->encryption_level() == ENCRYPTION_NONE) { | 258 if (frames != NULL && frames->encryption_level() == ENCRYPTION_NONE) { |
259 // Once you're forward secure, no unencrypted packets will be sent, crypto | 259 // Once you're forward secure, no unencrypted packets will be sent, crypto |
260 // or otherwise. Unencrypted packets are neutered and abandoned, to ensure | 260 // or otherwise. Unencrypted packets are neutered and abandoned, to ensure |
261 // they are not retransmitted or considered lost from a congestion control | 261 // they are not retransmitted or considered lost from a congestion control |
262 // perspective. | 262 // perspective. |
263 pending_retransmissions_.erase(it->first); | 263 pending_retransmissions_.erase(it->first); |
264 // TODO(ianswett): This may cause packets to linger forever in the | |
265 // UnackedPacketMap. | |
266 unacked_packets_.NeuterPacket(it->first); | 264 unacked_packets_.NeuterPacket(it->first); |
267 unacked_packets_.SetNotPending(it->first); | 265 unacked_packets_.SetNotPending(it->first); |
268 } | 266 } |
269 } | 267 } |
270 } | 268 } |
271 | 269 |
272 void QuicSentPacketManager::MarkForRetransmission( | 270 void QuicSentPacketManager::MarkForRetransmission( |
273 QuicPacketSequenceNumber sequence_number, | 271 QuicPacketSequenceNumber sequence_number, |
274 TransmissionType transmission_type) { | 272 TransmissionType transmission_type) { |
275 const TransmissionInfo& transmission_info = | 273 const TransmissionInfo& transmission_info = |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 return; | 764 return; |
767 } | 765 } |
768 | 766 |
769 using_pacing_ = true; | 767 using_pacing_ = true; |
770 send_algorithm_.reset( | 768 send_algorithm_.reset( |
771 new PacingSender(send_algorithm_.release(), | 769 new PacingSender(send_algorithm_.release(), |
772 QuicTime::Delta::FromMicroseconds(1))); | 770 QuicTime::Delta::FromMicroseconds(1))); |
773 } | 771 } |
774 | 772 |
775 } // namespace net | 773 } // namespace net |
OLD | NEW |