| 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 #ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 5 #ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| 6 #define NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 6 #define NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "net/base/linked_hash_map.h" | 18 #include "net/base/linked_hash_map.h" |
| 19 #include "net/quic/congestion_control/loss_detection_interface.h" |
| 19 #include "net/quic/congestion_control/send_algorithm_interface.h" | 20 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 20 #include "net/quic/quic_ack_notifier_manager.h" | 21 #include "net/quic/quic_ack_notifier_manager.h" |
| 21 #include "net/quic/quic_protocol.h" | 22 #include "net/quic/quic_protocol.h" |
| 22 #include "net/quic/quic_unacked_packet_map.h" | 23 #include "net/quic/quic_unacked_packet_map.h" |
| 23 | 24 |
| 24 NET_EXPORT_PRIVATE extern bool FLAGS_track_retransmission_history; | 25 NET_EXPORT_PRIVATE extern bool FLAGS_track_retransmission_history; |
| 25 NET_EXPORT_PRIVATE extern bool FLAGS_enable_quic_pacing; | 26 NET_EXPORT_PRIVATE extern bool FLAGS_enable_quic_pacing; |
| 26 | 27 |
| 27 namespace net { | 28 namespace net { |
| 28 | 29 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 214 |
| 214 // Update the RTT if the ack is for the largest acked sequence number. | 215 // Update the RTT if the ack is for the largest acked sequence number. |
| 215 void MaybeUpdateRTT(const ReceivedPacketInfo& received_info, | 216 void MaybeUpdateRTT(const ReceivedPacketInfo& received_info, |
| 216 const QuicTime& ack_receive_time); | 217 const QuicTime& ack_receive_time); |
| 217 | 218 |
| 218 // Chooses whether to nack retransmit any packets based on the receipt info. | 219 // Chooses whether to nack retransmit any packets based on the receipt info. |
| 219 // All acks have been handled before this method is invoked. | 220 // All acks have been handled before this method is invoked. |
| 220 void MaybeRetransmitOnAckFrame(const ReceivedPacketInfo& received_info, | 221 void MaybeRetransmitOnAckFrame(const ReceivedPacketInfo& received_info, |
| 221 const QuicTime& ack_receive_time); | 222 const QuicTime& ack_receive_time); |
| 222 | 223 |
| 224 // Invokes the loss detection algorithm and loses and retransmits packets if |
| 225 // necessary. |
| 226 void InvokeLossDetection(QuicTime time); |
| 227 |
| 223 // Marks |sequence_number| as being fully handled, either due to receipt | 228 // Marks |sequence_number| as being fully handled, either due to receipt |
| 224 // by the peer, or having been discarded as indecipherable. Returns an | 229 // by the peer, or having been discarded as indecipherable. Returns an |
| 225 // iterator to the next remaining unacked packet. | 230 // iterator to the next remaining unacked packet. |
| 226 QuicUnackedPacketMap::const_iterator MarkPacketHandled( | 231 QuicUnackedPacketMap::const_iterator MarkPacketHandled( |
| 227 QuicPacketSequenceNumber sequence_number, | 232 QuicPacketSequenceNumber sequence_number, |
| 228 ReceivedByPeer received_by_peer); | 233 ReceivedByPeer received_by_peer); |
| 229 | 234 |
| 230 // Request that |sequence_number| be retransmitted after the other pending | 235 // Request that |sequence_number| be retransmitted after the other pending |
| 231 // retransmissions. Does not add it to the retransmissions if it's already | 236 // retransmissions. Does not add it to the retransmissions if it's already |
| 232 // a pending retransmission. | 237 // a pending retransmission. |
| 233 void MarkForRetransmission(QuicPacketSequenceNumber sequence_number, | 238 void MarkForRetransmission(QuicPacketSequenceNumber sequence_number, |
| 234 TransmissionType transmission_type); | 239 TransmissionType transmission_type); |
| 235 | 240 |
| 236 static SequenceNumberSet DetectLostPackets( | |
| 237 const QuicUnackedPacketMap& unacked_packets, | |
| 238 const QuicTime& time, | |
| 239 QuicPacketSequenceNumber largest_observed); | |
| 240 | |
| 241 // Newly serialized retransmittable and fec packets are added to this map, | 241 // Newly serialized retransmittable and fec packets are added to this map, |
| 242 // which contains owning pointers to any contained frames. If a packet is | 242 // which contains owning pointers to any contained frames. If a packet is |
| 243 // retransmitted, this map will contain entries for both the old and the new | 243 // retransmitted, this map will contain entries for both the old and the new |
| 244 // packet. The old packet's retransmittable frames entry will be NULL, while | 244 // packet. The old packet's retransmittable frames entry will be NULL, while |
| 245 // the new packet's entry will contain the frames to retransmit. | 245 // the new packet's entry will contain the frames to retransmit. |
| 246 // If the old packet is acked before the new packet, then the old entry will | 246 // If the old packet is acked before the new packet, then the old entry will |
| 247 // be removed from the map and the new entry's retransmittable frames will be | 247 // be removed from the map and the new entry's retransmittable frames will be |
| 248 // set to NULL. | 248 // set to NULL. |
| 249 QuicUnackedPacketMap unacked_packets_; | 249 QuicUnackedPacketMap unacked_packets_; |
| 250 | 250 |
| 251 // Pending retransmissions which have not been packetized and sent yet. | 251 // Pending retransmissions which have not been packetized and sent yet. |
| 252 PendingRetransmissionMap pending_retransmissions_; | 252 PendingRetransmissionMap pending_retransmissions_; |
| 253 | 253 |
| 254 // Tracks if the connection was created by the server. | 254 // Tracks if the connection was created by the server. |
| 255 bool is_server_; | 255 bool is_server_; |
| 256 | 256 |
| 257 // An AckNotifier can register to be informed when ACKs have been received for | 257 // An AckNotifier can register to be informed when ACKs have been received for |
| 258 // all packets that a given block of data was sent in. The AckNotifierManager | 258 // all packets that a given block of data was sent in. The AckNotifierManager |
| 259 // maintains the currently active notifiers. | 259 // maintains the currently active notifiers. |
| 260 AckNotifierManager ack_notifier_manager_; | 260 AckNotifierManager ack_notifier_manager_; |
| 261 | 261 |
| 262 const QuicClock* clock_; | 262 const QuicClock* clock_; |
| 263 QuicConnectionStats* stats_; | 263 QuicConnectionStats* stats_; |
| 264 scoped_ptr<SendAlgorithmInterface> send_algorithm_; | 264 scoped_ptr<SendAlgorithmInterface> send_algorithm_; |
| 265 scoped_ptr<LossDetectionInterface> loss_algorithm_; |
| 265 QuicTime::Delta rtt_sample_; // RTT estimate from the most recent ACK. | 266 QuicTime::Delta rtt_sample_; // RTT estimate from the most recent ACK. |
| 267 QuicPacketSequenceNumber largest_observed_; // From the most recent ACK. |
| 266 // Number of outstanding crypto handshake packets. | 268 // Number of outstanding crypto handshake packets. |
| 267 size_t pending_crypto_packet_count_; | 269 size_t pending_crypto_packet_count_; |
| 268 // Number of times the RTO timer has fired in a row without receiving an ack. | 270 // Number of times the RTO timer has fired in a row without receiving an ack. |
| 269 size_t consecutive_rto_count_; | 271 size_t consecutive_rto_count_; |
| 270 // Number of times the tail loss probe has been sent. | 272 // Number of times the tail loss probe has been sent. |
| 271 size_t consecutive_tlp_count_; | 273 size_t consecutive_tlp_count_; |
| 272 // Number of times the crypto handshake has been retransmitted. | 274 // Number of times the crypto handshake has been retransmitted. |
| 273 size_t consecutive_crypto_retransmission_count_; | 275 size_t consecutive_crypto_retransmission_count_; |
| 274 // Maximum number of tail loss probes to send before firing an RTO. | 276 // Maximum number of tail loss probes to send before firing an RTO. |
| 275 size_t max_tail_loss_probes_; | 277 size_t max_tail_loss_probes_; |
| 276 bool using_pacing_; | 278 bool using_pacing_; |
| 277 | 279 |
| 278 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 280 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 } // namespace net | 283 } // namespace net |
| 282 | 284 |
| 283 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 285 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| OLD | NEW |