| 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 MarkForRetransmission(unacked_it->first, ALL_UNACKED_RETRANSMISSION); | 247 MarkForRetransmission(unacked_it->first, ALL_UNACKED_RETRANSMISSION); |
| 248 } | 248 } |
| 249 ++unacked_it; | 249 ++unacked_it; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 void QuicSentPacketManager::NeuterUnencryptedPackets() { | 253 void QuicSentPacketManager::NeuterUnencryptedPackets() { |
| 254 QuicUnackedPacketMap::const_iterator unacked_it = unacked_packets_.begin(); | 254 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| 255 while (unacked_it != unacked_packets_.end()) { | 255 it != unacked_packets_.end(); ++it) { |
| 256 const RetransmittableFrames* frames = | 256 const RetransmittableFrames* frames = |
| 257 unacked_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 // Since once you're forward secure, no unencrypted packets will be sent, | 259 // Once you're forward secure, no unencrypted packets will be sent, crypto |
| 260 // crypto or otherwise. Unencrypted packets are neutered and abandoned, to | 260 // or otherwise. Unencrypted packets are neutered and abandoned, to ensure |
| 261 // ensure they are not retransmitted or considered lost from a congestion | 261 // they are not retransmitted or considered lost from a congestion control |
| 262 // control perspective. | 262 // perspective. |
| 263 pending_retransmissions_.erase(unacked_it->first); | 263 pending_retransmissions_.erase(it->first); |
| 264 // TODO(ianswett): This may cause packets to linger forever in the | 264 // TODO(ianswett): This may cause packets to linger forever in the |
| 265 // UnackedPacketMap. | 265 // UnackedPacketMap. |
| 266 unacked_packets_.NeuterPacket(unacked_it->first); | 266 unacked_packets_.NeuterPacket(it->first); |
| 267 unacked_packets_.SetNotPending(unacked_it->first); | 267 unacked_packets_.SetNotPending(it->first); |
| 268 } | 268 } |
| 269 ++unacked_it; | |
| 270 } | 269 } |
| 271 } | 270 } |
| 272 | 271 |
| 273 void QuicSentPacketManager::MarkForRetransmission( | 272 void QuicSentPacketManager::MarkForRetransmission( |
| 274 QuicPacketSequenceNumber sequence_number, | 273 QuicPacketSequenceNumber sequence_number, |
| 275 TransmissionType transmission_type) { | 274 TransmissionType transmission_type) { |
| 276 const TransmissionInfo& transmission_info = | 275 const TransmissionInfo& transmission_info = |
| 277 unacked_packets_.GetTransmissionInfo(sequence_number); | 276 unacked_packets_.GetTransmissionInfo(sequence_number); |
| 278 LOG_IF(DFATAL, transmission_info.retransmittable_frames == NULL); | 277 LOG_IF(DFATAL, transmission_info.retransmittable_frames == NULL); |
| 279 if (transmission_type != TLP_RETRANSMISSION) { | 278 if (transmission_type != TLP_RETRANSMISSION) { |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 return; | 766 return; |
| 768 } | 767 } |
| 769 | 768 |
| 770 using_pacing_ = true; | 769 using_pacing_ = true; |
| 771 send_algorithm_.reset( | 770 send_algorithm_.reset( |
| 772 new PacingSender(send_algorithm_.release(), | 771 new PacingSender(send_algorithm_.release(), |
| 773 QuicTime::Delta::FromMicroseconds(1))); | 772 QuicTime::Delta::FromMicroseconds(1))); |
| 774 } | 773 } |
| 775 | 774 |
| 776 } // namespace net | 775 } // namespace net |
| OLD | NEW |