| 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> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 NOT_RECEIVED_BY_PEER, | 183 NOT_RECEIVED_BY_PEER, |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 enum RetransmissionTimeoutMode { | 186 enum RetransmissionTimeoutMode { |
| 187 RTO_MODE, | 187 RTO_MODE, |
| 188 TLP_MODE, | 188 TLP_MODE, |
| 189 HANDSHAKE_MODE, | 189 HANDSHAKE_MODE, |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 struct TransmissionInfo { | 192 struct TransmissionInfo { |
| 193 TransmissionInfo() | 193 TransmissionInfo(); |
| 194 : retransmittable_frames(NULL), | 194 |
| 195 sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER), | 195 // Constructs a Transmission with a new all_tranmissions set |
| 196 sent_time(QuicTime::Zero()), | 196 // containing |sequence_number|. |
| 197 previous_transmissions(NULL), | |
| 198 pending(false) { } | |
| 199 TransmissionInfo(RetransmittableFrames* retransmittable_frames, | 197 TransmissionInfo(RetransmittableFrames* retransmittable_frames, |
| 200 QuicSequenceNumberLength sequence_number_length) | 198 QuicPacketSequenceNumber sequence_number, |
| 201 : retransmittable_frames(retransmittable_frames), | 199 QuicSequenceNumberLength sequence_number_length); |
| 202 sequence_number_length(sequence_number_length), | 200 |
| 203 sent_time(QuicTime::Zero()), | 201 // Constructs a Transmission with the specified |all_tranmissions| set |
| 204 previous_transmissions(NULL), | 202 // and inserts |sequence_number| into it. |
| 205 pending(false) { | 203 TransmissionInfo(RetransmittableFrames* retransmittable_frames, |
| 206 } | 204 QuicPacketSequenceNumber sequence_number, |
| 205 QuicSequenceNumberLength sequence_number_length, |
| 206 SequenceNumberSet* all_transmissions); |
| 207 | 207 |
| 208 RetransmittableFrames* retransmittable_frames; | 208 RetransmittableFrames* retransmittable_frames; |
| 209 QuicSequenceNumberLength sequence_number_length; | 209 QuicSequenceNumberLength sequence_number_length; |
| 210 // Zero when the packet is serialized, non-zero once it's sent. | 210 // Zero when the packet is serialized, non-zero once it's sent. |
| 211 QuicTime sent_time; | 211 QuicTime sent_time; |
| 212 // Stores all previous transmissions if the packet has been retransmitted, | 212 // Stores the sequence numbers of all transmissions of this packet. |
| 213 // and is NULL otherwise. | 213 // Can never be null. |
| 214 SequenceNumberSet* previous_transmissions; | 214 SequenceNumberSet* all_transmissions; |
| 215 // Pending packets have not been abandoned or lost. | 215 // Pending packets have not been abandoned or lost. |
| 216 bool pending; | 216 bool pending; |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 typedef linked_hash_map<QuicPacketSequenceNumber, | 219 typedef linked_hash_map<QuicPacketSequenceNumber, |
| 220 TransmissionInfo> UnackedPacketMap; | 220 TransmissionInfo> UnackedPacketMap; |
| 221 typedef linked_hash_map<QuicPacketSequenceNumber, | 221 typedef linked_hash_map<QuicPacketSequenceNumber, |
| 222 TransmissionType> PendingRetransmissionMap; | 222 TransmissionType> PendingRetransmissionMap; |
| 223 | 223 |
| 224 static bool HasCryptoHandshake(const TransmissionInfo& transmission_info); | 224 static bool HasCryptoHandshake(const TransmissionInfo& transmission_info); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 const QuicTime& ack_receive_time); | 264 const QuicTime& ack_receive_time); |
| 265 | 265 |
| 266 // Marks |sequence_number| as being fully handled, either due to receipt | 266 // Marks |sequence_number| as being fully handled, either due to receipt |
| 267 // by the peer, or having been discarded as indecipherable. Returns an | 267 // by the peer, or having been discarded as indecipherable. Returns an |
| 268 // iterator to the next remaining unacked packet. | 268 // iterator to the next remaining unacked packet. |
| 269 UnackedPacketMap::iterator MarkPacketHandled( | 269 UnackedPacketMap::iterator MarkPacketHandled( |
| 270 QuicPacketSequenceNumber sequence_number, | 270 QuicPacketSequenceNumber sequence_number, |
| 271 ReceivedByPeer received_by_peer); | 271 ReceivedByPeer received_by_peer); |
| 272 | 272 |
| 273 // Removes entries from the unacked packet map. | 273 // Removes entries from the unacked packet map. |
| 274 void DiscardPacket(QuicPacketSequenceNumber sequence_number); | 274 void RemovePacket(QuicPacketSequenceNumber sequence_number); |
| 275 | 275 |
| 276 // Request that |sequence_number| be retransmitted after the other pending | 276 // Request that |sequence_number| be retransmitted after the other pending |
| 277 // retransmissions. Does not add it to the retransmissions if it's already | 277 // retransmissions. Does not add it to the retransmissions if it's already |
| 278 // a pending retransmission. | 278 // a pending retransmission. |
| 279 void MarkForRetransmission(QuicPacketSequenceNumber sequence_number, | 279 void MarkForRetransmission(QuicPacketSequenceNumber sequence_number, |
| 280 TransmissionType transmission_type); | 280 TransmissionType transmission_type); |
| 281 | 281 |
| 282 // Clears up to |num_to_clear| previous transmissions in order to make room | 282 // Clears up to |num_to_clear| previous transmissions in order to make room |
| 283 // in the ack frame for new acks. | 283 // in the ack frame for new acks. |
| 284 void ClearPreviousRetransmissions(size_t num_to_clear); | 284 void ClearPreviousRetransmissions(size_t num_to_clear); |
| 285 | 285 |
| 286 void CleanupPacketHistory(); | 286 void CleanupPacketHistory(); |
| 287 | 287 |
| 288 // Removes |sequence_number| as a previous transmission of any other packets. | |
| 289 void RemovePreviousTransmission(QuicPacketSequenceNumber sequence_number); | |
| 290 | |
| 291 // Newly serialized retransmittable and fec packets are added to this map, | 288 // Newly serialized retransmittable and fec packets are added to this map, |
| 292 // which contains owning pointers to any contained frames. If a packet is | 289 // which contains owning pointers to any contained frames. If a packet is |
| 293 // retransmitted, this map will contain entries for both the old and the new | 290 // retransmitted, this map will contain entries for both the old and the new |
| 294 // packet. The old packet's retransmittable frames entry will be NULL, while | 291 // packet. The old packet's retransmittable frames entry will be NULL, while |
| 295 // the new packet's entry will contain the frames to retransmit. | 292 // the new packet's entry will contain the frames to retransmit. |
| 296 // If the old packet is acked before the new packet, then the old entry will | 293 // If the old packet is acked before the new packet, then the old entry will |
| 297 // be removed from the map and the new entry's retransmittable frames will be | 294 // be removed from the map and the new entry's retransmittable frames will be |
| 298 // set to NULL. | 295 // set to NULL. |
| 299 UnackedPacketMap unacked_packets_; | 296 UnackedPacketMap unacked_packets_; |
| 300 | 297 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 327 // Maximum number of tail loss probes to send before firing an RTO. | 324 // Maximum number of tail loss probes to send before firing an RTO. |
| 328 size_t max_tail_loss_probes_; | 325 size_t max_tail_loss_probes_; |
| 329 bool using_pacing_; | 326 bool using_pacing_; |
| 330 | 327 |
| 331 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 328 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
| 332 }; | 329 }; |
| 333 | 330 |
| 334 } // namespace net | 331 } // namespace net |
| 335 | 332 |
| 336 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 333 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| OLD | NEW |