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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/congestion_control/pacing_sender.h" | 9 #include "net/quic/congestion_control/pacing_sender.h" |
10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Packet was acked, so remove it from our unacked packet list. | 245 // Packet was acked, so remove it from our unacked packet list. |
246 DVLOG(1) << ENDPOINT <<"Got an ack for packet " << sequence_number; | 246 DVLOG(1) << ENDPOINT <<"Got an ack for packet " << sequence_number; |
247 // If data is associated with the most recent transmission of this | 247 // If data is associated with the most recent transmission of this |
248 // packet, then inform the caller. | 248 // packet, then inform the caller. |
249 it = MarkPacketHandled(sequence_number, RECEIVED_BY_PEER); | 249 it = MarkPacketHandled(sequence_number, RECEIVED_BY_PEER); |
250 | 250 |
251 // The AckNotifierManager is informed of every ACKed sequence number. | 251 // The AckNotifierManager is informed of every ACKed sequence number. |
252 ack_notifier_manager_.OnPacketAcked(sequence_number); | 252 ack_notifier_manager_.OnPacketAcked(sequence_number); |
253 } | 253 } |
254 | 254 |
| 255 // Discard any retransmittable frames associated with revived packets. |
| 256 for (SequenceNumberSet::const_iterator revived_it = |
| 257 received_info.revived_packets.begin(); |
| 258 revived_it != received_info.revived_packets.end(); ++revived_it) { |
| 259 TransmissionInfo* transmission_info = |
| 260 FindOrNull(unacked_packets_, *revived_it); |
| 261 if (transmission_info == NULL) { |
| 262 continue; |
| 263 } |
| 264 // The retransmittable frames are removed from the most recent transmission. |
| 265 transmission_info = |
| 266 FindOrNull(unacked_packets_, |
| 267 *transmission_info->all_transmissions->rbegin()); |
| 268 if (transmission_info->retransmittable_frames == NULL) { |
| 269 continue; |
| 270 } |
| 271 delete transmission_info->retransmittable_frames; |
| 272 transmission_info->retransmittable_frames = NULL; |
| 273 } |
| 274 |
255 // If we have received a truncated ack, then we need to | 275 // If we have received a truncated ack, then we need to |
256 // clear out some previous transmissions to allow the peer | 276 // clear out some previous transmissions to allow the peer |
257 // to actually ACK new packets. | 277 // to actually ACK new packets. |
258 if (received_info.is_truncated) { | 278 if (received_info.is_truncated) { |
259 ClearPreviousRetransmissions(received_info.missing_packets.size() / 2); | 279 ClearPreviousRetransmissions(received_info.missing_packets.size() / 2); |
260 } | 280 } |
261 } | 281 } |
262 | 282 |
263 void QuicSentPacketManager::ClearPreviousRetransmissions(size_t num_to_clear) { | 283 void QuicSentPacketManager::ClearPreviousRetransmissions(size_t num_to_clear) { |
264 UnackedPacketMap::iterator it = unacked_packets_.begin(); | 284 UnackedPacketMap::iterator it = unacked_packets_.begin(); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 return; | 972 return; |
953 } | 973 } |
954 | 974 |
955 using_pacing_ = true; | 975 using_pacing_ = true; |
956 send_algorithm_.reset( | 976 send_algorithm_.reset( |
957 new PacingSender(send_algorithm_.release(), | 977 new PacingSender(send_algorithm_.release(), |
958 QuicTime::Delta::FromMicroseconds(1))); | 978 QuicTime::Delta::FromMicroseconds(1))); |
959 } | 979 } |
960 | 980 |
961 } // namespace net | 981 } // namespace net |
OLD | NEW |