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::NeuterUnencryptedPackets() { | 254 void QuicSentPacketManager::DiscardUnencryptedPackets() { |
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 // Since once you're forward secure, no unencrypted packets will be sent, | 260 // Once you're forward secure, no unencrypted packets will be sent. |
261 // crypto or otherwise. Unencrypted packets are neutered and abandoned, to | 261 // Additionally, it's likely the peer will be forward secure, and no acks |
262 // ensure they are not retransmitted or considered lost from a congestion | 262 // for these packets will be received, so mark the packet as handled. |
263 // control perspective. | |
264 pending_retransmissions_.erase(unacked_it->first); | 263 pending_retransmissions_.erase(unacked_it->first); |
265 unacked_packets_.NeuterPacket(unacked_it->first); | 264 unacked_it = MarkPacketHandled(unacked_it->first, |
266 unacked_packets_.SetNotPending(unacked_it->first); | 265 QuicTime::Delta::Zero()); |
| 266 continue; |
267 } | 267 } |
268 ++unacked_it; | 268 ++unacked_it; |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 void QuicSentPacketManager::MarkForRetransmission( | 272 void QuicSentPacketManager::MarkForRetransmission( |
273 QuicPacketSequenceNumber sequence_number, | 273 QuicPacketSequenceNumber sequence_number, |
274 TransmissionType transmission_type) { | 274 TransmissionType transmission_type) { |
275 const TransmissionInfo& transmission_info = | 275 const TransmissionInfo& transmission_info = |
276 unacked_packets_.GetTransmissionInfo(sequence_number); | 276 unacked_packets_.GetTransmissionInfo(sequence_number); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 return; | 746 return; |
747 } | 747 } |
748 | 748 |
749 using_pacing_ = true; | 749 using_pacing_ = true; |
750 send_algorithm_.reset( | 750 send_algorithm_.reset( |
751 new PacingSender(send_algorithm_.release(), | 751 new PacingSender(send_algorithm_.release(), |
752 QuicTime::Delta::FromMicroseconds(1))); | 752 QuicTime::Delta::FromMicroseconds(1))); |
753 } | 753 } |
754 | 754 |
755 } // namespace net | 755 } // namespace net |
OLD | NEW |