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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // numbers with no connection to the previous ones. | 244 // numbers with no connection to the previous ones. |
245 if (frames != NULL && (retransmission_type == ALL_PACKETS || | 245 if (frames != NULL && (retransmission_type == ALL_PACKETS || |
246 frames->encryption_level() == ENCRYPTION_INITIAL)) { | 246 frames->encryption_level() == ENCRYPTION_INITIAL)) { |
247 unacked_packets_.SetNotPending(unacked_it->first); | 247 unacked_packets_.SetNotPending(unacked_it->first); |
248 MarkForRetransmission(unacked_it->first, ALL_UNACKED_RETRANSMISSION); | 248 MarkForRetransmission(unacked_it->first, ALL_UNACKED_RETRANSMISSION); |
249 } | 249 } |
250 ++unacked_it; | 250 ++unacked_it; |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 void QuicSentPacketManager::DiscardUnencryptedPackets() { | 254 void QuicSentPacketManager::NeuterUnencryptedPackets() { |
255 QuicUnackedPacketMap::const_iterator unacked_it = unacked_packets_.begin(); | 255 QuicUnackedPacketMap::const_iterator unacked_it = unacked_packets_.begin(); |
256 while (unacked_it != unacked_packets_.end()) { | 256 while (unacked_it != unacked_packets_.end()) { |
257 const RetransmittableFrames* frames = | 257 const RetransmittableFrames* frames = |
258 unacked_it->second.retransmittable_frames; | 258 unacked_it->second.retransmittable_frames; |
259 if (frames != NULL && frames->encryption_level() == ENCRYPTION_NONE) { | 259 if (frames != NULL && frames->encryption_level() == ENCRYPTION_NONE) { |
260 // Once you're forward secure, no unencrypted packets will be sent. | 260 // Since once you're forward secure, no unencrypted packets will be sent, |
261 // Additionally, it's likely the peer will be forward secure, and no acks | 261 // crypto or otherwise. Unencrypted packets are neutered and abandoned, to |
262 // for these packets will be received, so mark the packet as handled. | 262 // ensure they are not retransmitted or considered lost from a congestion |
| 263 // control perspective. |
263 pending_retransmissions_.erase(unacked_it->first); | 264 pending_retransmissions_.erase(unacked_it->first); |
264 unacked_it = MarkPacketHandled(unacked_it->first, | 265 // TODO(ianswett): This may cause packets to linger forever in the |
265 QuicTime::Delta::Zero()); | 266 // UnackedPacketMap. |
266 continue; | 267 unacked_packets_.NeuterPacket(unacked_it->first); |
| 268 unacked_packets_.SetNotPending(unacked_it->first); |
267 } | 269 } |
268 ++unacked_it; | 270 ++unacked_it; |
269 } | 271 } |
270 } | 272 } |
271 | 273 |
272 void QuicSentPacketManager::MarkForRetransmission( | 274 void QuicSentPacketManager::MarkForRetransmission( |
273 QuicPacketSequenceNumber sequence_number, | 275 QuicPacketSequenceNumber sequence_number, |
274 TransmissionType transmission_type) { | 276 TransmissionType transmission_type) { |
275 const TransmissionInfo& transmission_info = | 277 const TransmissionInfo& transmission_info = |
276 unacked_packets_.GetTransmissionInfo(sequence_number); | 278 unacked_packets_.GetTransmissionInfo(sequence_number); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 return; | 758 return; |
757 } | 759 } |
758 | 760 |
759 using_pacing_ = true; | 761 using_pacing_ = true; |
760 send_algorithm_.reset( | 762 send_algorithm_.reset( |
761 new PacingSender(send_algorithm_.release(), | 763 new PacingSender(send_algorithm_.release(), |
762 QuicTime::Delta::FromMicroseconds(1))); | 764 QuicTime::Delta::FromMicroseconds(1))); |
763 } | 765 } |
764 | 766 |
765 } // namespace net | 767 } // namespace net |
OLD | NEW |