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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 QuicTime sent_time, | 58 QuicTime sent_time, |
59 QuicByteCount bytes) {} | 59 QuicByteCount bytes) {} |
60 | 60 |
61 virtual void OnRetransmittedPacket( | 61 virtual void OnRetransmittedPacket( |
62 QuicPacketSequenceNumber old_sequence_number, | 62 QuicPacketSequenceNumber old_sequence_number, |
63 QuicPacketSequenceNumber new_sequence_number, | 63 QuicPacketSequenceNumber new_sequence_number, |
64 TransmissionType transmission_type, | 64 TransmissionType transmission_type, |
65 QuicTime time) {} | 65 QuicTime time) {} |
66 | 66 |
67 virtual void OnIncomingAck( | 67 virtual void OnIncomingAck( |
68 const ReceivedPacketInfo& received_info, | 68 const QuicAckFrame& ack_frame, |
69 QuicTime ack_receive_time, | 69 QuicTime ack_receive_time, |
70 QuicPacketSequenceNumber largest_observed, | 70 QuicPacketSequenceNumber largest_observed, |
71 bool largest_observed_acked, | 71 bool largest_observed_acked, |
72 QuicPacketSequenceNumber least_unacked_sent_packet) {} | 72 QuicPacketSequenceNumber least_unacked_sent_packet) {} |
73 }; | 73 }; |
74 | 74 |
75 // Interface which gets callbacks from the QuicSentPacketManager when | 75 // Interface which gets callbacks from the QuicSentPacketManager when |
76 // network-related state changes. Implementations must not mutate the | 76 // network-related state changes. Implementations must not mutate the |
77 // state of the packet manager as a result of these callbacks. | 77 // state of the packet manager as a result of these callbacks. |
78 class NET_EXPORT_PRIVATE NetworkChangeVisitor { | 78 class NET_EXPORT_PRIVATE NetworkChangeVisitor { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // retransmittable data, it will be added to the unacked packet map. | 115 // retransmittable data, it will be added to the unacked packet map. |
116 void OnSerializedPacket(const SerializedPacket& serialized_packet); | 116 void OnSerializedPacket(const SerializedPacket& serialized_packet); |
117 | 117 |
118 // Called when a packet is retransmitted with a new sequence number. | 118 // Called when a packet is retransmitted with a new sequence number. |
119 // Replaces the old entry in the unacked packet map with the new | 119 // Replaces the old entry in the unacked packet map with the new |
120 // sequence number. | 120 // sequence number. |
121 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, | 121 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, |
122 QuicPacketSequenceNumber new_sequence_number); | 122 QuicPacketSequenceNumber new_sequence_number); |
123 | 123 |
124 // Processes the incoming ack. | 124 // Processes the incoming ack. |
125 void OnIncomingAck(const ReceivedPacketInfo& received_info, | 125 void OnIncomingAck(const QuicAckFrame& ack_frame, |
126 QuicTime ack_receive_time); | 126 QuicTime ack_receive_time); |
127 | 127 |
128 // Returns true if the non-FEC packet |sequence_number| is unacked. | 128 // Returns true if the non-FEC packet |sequence_number| is unacked. |
129 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; | 129 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; |
130 | 130 |
131 // Requests retransmission of all unacked packets of |retransmission_type|. | 131 // Requests retransmission of all unacked packets of |retransmission_type|. |
132 void RetransmitUnackedPackets(RetransmissionType retransmission_type); | 132 void RetransmitUnackedPackets(RetransmissionType retransmission_type); |
133 | 133 |
134 // Retransmits the oldest pending packet there is still a tail loss probe | 134 // Retransmits the oldest pending packet there is still a tail loss probe |
135 // pending. Invoked after OnRetransmissionTimeout. | 135 // pending. Invoked after OnRetransmissionTimeout. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 HANDSHAKE_MODE, | 243 HANDSHAKE_MODE, |
244 // Re-invoke the loss detection when a packet is not acked before the | 244 // Re-invoke the loss detection when a packet is not acked before the |
245 // loss detection algorithm expects. | 245 // loss detection algorithm expects. |
246 LOSS_MODE, | 246 LOSS_MODE, |
247 }; | 247 }; |
248 | 248 |
249 typedef linked_hash_map<QuicPacketSequenceNumber, | 249 typedef linked_hash_map<QuicPacketSequenceNumber, |
250 TransmissionType> PendingRetransmissionMap; | 250 TransmissionType> PendingRetransmissionMap; |
251 | 251 |
252 // Process the incoming ack looking for newly ack'd data packets. | 252 // Process the incoming ack looking for newly ack'd data packets. |
253 void HandleAckForSentPackets(const ReceivedPacketInfo& received_info); | 253 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); |
254 | 254 |
255 // Returns the current retransmission mode. | 255 // Returns the current retransmission mode. |
256 RetransmissionTimeoutMode GetRetransmissionMode() const; | 256 RetransmissionTimeoutMode GetRetransmissionMode() const; |
257 | 257 |
258 // Retransmits all crypto stream packets. | 258 // Retransmits all crypto stream packets. |
259 void RetransmitCryptoPackets(); | 259 void RetransmitCryptoPackets(); |
260 | 260 |
261 // Retransmits all the packets and abandons by invoking a full RTO. | 261 // Retransmits all the packets and abandons by invoking a full RTO. |
262 void RetransmitAllPackets(); | 262 void RetransmitAllPackets(); |
263 | 263 |
264 // Returns the timer for retransmitting crypto handshake packets. | 264 // Returns the timer for retransmitting crypto handshake packets. |
265 const QuicTime::Delta GetCryptoRetransmissionDelay() const; | 265 const QuicTime::Delta GetCryptoRetransmissionDelay() const; |
266 | 266 |
267 // Returns the timer for a new tail loss probe. | 267 // Returns the timer for a new tail loss probe. |
268 const QuicTime::Delta GetTailLossProbeDelay() const; | 268 const QuicTime::Delta GetTailLossProbeDelay() const; |
269 | 269 |
270 // Returns the retransmission timeout, after which a full RTO occurs. | 270 // Returns the retransmission timeout, after which a full RTO occurs. |
271 const QuicTime::Delta GetRetransmissionDelay() const; | 271 const QuicTime::Delta GetRetransmissionDelay() const; |
272 | 272 |
273 // Update the RTT if the ack is for the largest acked sequence number. | 273 // Update the RTT if the ack is for the largest acked sequence number. |
274 // Returns true if the rtt was updated. | 274 // Returns true if the rtt was updated. |
275 bool MaybeUpdateRTT(const ReceivedPacketInfo& received_info, | 275 bool MaybeUpdateRTT(const QuicAckFrame& ack_frame, |
276 const QuicTime& ack_receive_time); | 276 const QuicTime& ack_receive_time); |
277 | 277 |
278 // Invokes the loss detection algorithm and loses and retransmits packets if | 278 // Invokes the loss detection algorithm and loses and retransmits packets if |
279 // necessary. | 279 // necessary. |
280 void InvokeLossDetection(QuicTime time); | 280 void InvokeLossDetection(QuicTime time); |
281 | 281 |
282 // Invokes OnCongestionEvent if |rtt_updated| is true, there are pending acks, | 282 // Invokes OnCongestionEvent if |rtt_updated| is true, there are pending acks, |
283 // or pending losses. Clears pending acks and pending losses afterwards. | 283 // or pending losses. Clears pending acks and pending losses afterwards. |
284 // |bytes_in_flight| is the number of bytes in flight before the losses or | 284 // |bytes_in_flight| is the number of bytes in flight before the losses or |
285 // acks. | 285 // acks. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // Sets of packets acked and lost as a result of the last congestion event. | 361 // Sets of packets acked and lost as a result of the last congestion event. |
362 SendAlgorithmInterface::CongestionMap packets_acked_; | 362 SendAlgorithmInterface::CongestionMap packets_acked_; |
363 SendAlgorithmInterface::CongestionMap packets_lost_; | 363 SendAlgorithmInterface::CongestionMap packets_lost_; |
364 | 364 |
365 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 365 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
366 }; | 366 }; |
367 | 367 |
368 } // namespace net | 368 } // namespace net |
369 | 369 |
370 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 370 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
OLD | NEW |