| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class NET_EXPORT_PRIVATE QuicSentPacketManager { | 41 class NET_EXPORT_PRIVATE QuicSentPacketManager { |
| 42 public: | 42 public: |
| 43 // Interface which gets callbacks from the QuicSentPacketManager at | 43 // Interface which gets callbacks from the QuicSentPacketManager at |
| 44 // interesting points. Implementations must not mutate the state of | 44 // interesting points. Implementations must not mutate the state of |
| 45 // the packet manager or connection as a result of these callbacks. | 45 // the packet manager or connection as a result of these callbacks. |
| 46 class NET_EXPORT_PRIVATE DebugDelegate { | 46 class NET_EXPORT_PRIVATE DebugDelegate { |
| 47 public: | 47 public: |
| 48 virtual ~DebugDelegate() {} | 48 virtual ~DebugDelegate() {} |
| 49 | 49 |
| 50 // Called when a spurious retransmission is detected. | 50 // Called when a spurious retransmission is detected. |
| 51 virtual void OnSpuriousPacketRetransmition( | 51 virtual void OnSpuriousPacketRetransmission( |
| 52 TransmissionType transmission_type, | 52 TransmissionType transmission_type, |
| 53 QuicByteCount byte_size) {} | 53 QuicByteCount byte_size) {} |
| 54 | 54 |
| 55 virtual void OnIncomingAck( | 55 virtual void OnIncomingAck( |
| 56 const QuicAckFrame& ack_frame, | 56 const QuicAckFrame& ack_frame, |
| 57 QuicTime ack_receive_time, | 57 QuicTime ack_receive_time, |
| 58 QuicPacketSequenceNumber largest_observed, | 58 QuicPacketSequenceNumber largest_observed, |
| 59 bool rtt_updated, | 59 bool rtt_updated, |
| 60 QuicPacketSequenceNumber least_unacked_sent_packet) {} | 60 QuicPacketSequenceNumber least_unacked_sent_packet) {} |
| 61 }; | 61 }; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Retrieves the next pending retransmission. You must ensure that | 149 // Retrieves the next pending retransmission. You must ensure that |
| 150 // there are pending retransmissions prior to calling this function. | 150 // there are pending retransmissions prior to calling this function. |
| 151 PendingRetransmission NextPendingRetransmission(); | 151 PendingRetransmission NextPendingRetransmission(); |
| 152 | 152 |
| 153 bool HasUnackedPackets() const; | 153 bool HasUnackedPackets() const; |
| 154 | 154 |
| 155 // Returns the smallest sequence number of a serialized packet which has not | 155 // Returns the smallest sequence number of a serialized packet which has not |
| 156 // been acked by the peer. | 156 // been acked by the peer. |
| 157 QuicPacketSequenceNumber GetLeastUnacked() const; | 157 QuicPacketSequenceNumber GetLeastUnacked() const; |
| 158 | 158 |
| 159 // Called when a congestion feedback frame is received from peer. | |
| 160 virtual void OnIncomingQuicCongestionFeedbackFrame( | |
| 161 const QuicCongestionFeedbackFrame& frame, | |
| 162 const QuicTime& feedback_receive_time); | |
| 163 | |
| 164 // Called when we have sent bytes to the peer. This informs the manager both | 159 // Called when we have sent bytes to the peer. This informs the manager both |
| 165 // the number of bytes sent and if they were retransmitted. Returns true if | 160 // the number of bytes sent and if they were retransmitted. Returns true if |
| 166 // the sender should reset the retransmission timer. | 161 // the sender should reset the retransmission timer. |
| 167 virtual bool OnPacketSent(SerializedPacket* serialized_packet, | 162 virtual bool OnPacketSent(SerializedPacket* serialized_packet, |
| 168 QuicPacketSequenceNumber original_sequence_number, | 163 QuicPacketSequenceNumber original_sequence_number, |
| 169 QuicTime sent_time, | 164 QuicTime sent_time, |
| 170 QuicByteCount bytes, | 165 QuicByteCount bytes, |
| 171 TransmissionType transmission_type, | 166 TransmissionType transmission_type, |
| 172 HasRetransmittableData has_retransmittable_data); | 167 HasRetransmittableData has_retransmittable_data); |
| 173 | 168 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // congestion window has been recently reduced, of if non-full packets are | 205 // congestion window has been recently reduced, of if non-full packets are |
| 211 // sent. | 206 // sent. |
| 212 QuicPacketCount EstimateMaxPacketsInFlight( | 207 QuicPacketCount EstimateMaxPacketsInFlight( |
| 213 QuicByteCount max_packet_length) const; | 208 QuicByteCount max_packet_length) const; |
| 214 | 209 |
| 215 // Returns the size of the slow start congestion window in nume of 1460 byte | 210 // Returns the size of the slow start congestion window in nume of 1460 byte |
| 216 // TCP segments, aka ssthresh. Some send algorithms do not define a slow | 211 // TCP segments, aka ssthresh. Some send algorithms do not define a slow |
| 217 // start threshold and will return 0. | 212 // start threshold and will return 0. |
| 218 QuicPacketCount GetSlowStartThresholdInTcpMss() const; | 213 QuicPacketCount GetSlowStartThresholdInTcpMss() const; |
| 219 | 214 |
| 215 // Called by the connection every time it receives a serialized packet. |
| 216 void OnSerializedPacket(const SerializedPacket& serialized_packet); |
| 217 |
| 220 // Enables pacing if it has not already been enabled. | 218 // Enables pacing if it has not already been enabled. |
| 221 void EnablePacing(); | 219 void EnablePacing(); |
| 222 | 220 |
| 223 bool using_pacing() const { return using_pacing_; } | 221 bool using_pacing() const { return using_pacing_; } |
| 224 | 222 |
| 225 void set_debug_delegate(DebugDelegate* debug_delegate) { | 223 void set_debug_delegate(DebugDelegate* debug_delegate) { |
| 226 debug_delegate_ = debug_delegate; | 224 debug_delegate_ = debug_delegate; |
| 227 } | 225 } |
| 228 | 226 |
| 229 QuicPacketSequenceNumber largest_observed() const { | 227 QuicPacketSequenceNumber largest_observed() const { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 278 |
| 281 // Process the incoming ack looking for newly ack'd data packets. | 279 // Process the incoming ack looking for newly ack'd data packets. |
| 282 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); | 280 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); |
| 283 | 281 |
| 284 // Returns the current retransmission mode. | 282 // Returns the current retransmission mode. |
| 285 RetransmissionTimeoutMode GetRetransmissionMode() const; | 283 RetransmissionTimeoutMode GetRetransmissionMode() const; |
| 286 | 284 |
| 287 // Retransmits all crypto stream packets. | 285 // Retransmits all crypto stream packets. |
| 288 void RetransmitCryptoPackets(); | 286 void RetransmitCryptoPackets(); |
| 289 | 287 |
| 288 // Retransmits two packets for an RTO and removes any non-retransmittable |
| 289 // packets from flight. |
| 290 void RetransmitRtoPackets(); |
| 291 |
| 290 // Retransmits all the packets and abandons by invoking a full RTO. | 292 // Retransmits all the packets and abandons by invoking a full RTO. |
| 291 void RetransmitAllPackets(); | 293 void RetransmitAllPackets(); |
| 292 | 294 |
| 293 // Returns the timer for retransmitting crypto handshake packets. | 295 // Returns the timer for retransmitting crypto handshake packets. |
| 294 const QuicTime::Delta GetCryptoRetransmissionDelay() const; | 296 const QuicTime::Delta GetCryptoRetransmissionDelay() const; |
| 295 | 297 |
| 296 // Returns the timer for a new tail loss probe. | 298 // Returns the timer for a new tail loss probe. |
| 297 const QuicTime::Delta GetTailLossProbeDelay() const; | 299 const QuicTime::Delta GetTailLossProbeDelay() const; |
| 298 | 300 |
| 299 // Returns the retransmission timeout, after which a full RTO occurs. | 301 // Returns the retransmission timeout, after which a full RTO occurs. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 385 |
| 384 // Tracks the first RTO packet. If any packet before that packet gets acked, | 386 // Tracks the first RTO packet. If any packet before that packet gets acked, |
| 385 // it indicates the RTO was spurious and should be reversed(F-RTO). | 387 // it indicates the RTO was spurious and should be reversed(F-RTO). |
| 386 QuicPacketSequenceNumber first_rto_transmission_; | 388 QuicPacketSequenceNumber first_rto_transmission_; |
| 387 // Number of times the RTO timer has fired in a row without receiving an ack. | 389 // Number of times the RTO timer has fired in a row without receiving an ack. |
| 388 size_t consecutive_rto_count_; | 390 size_t consecutive_rto_count_; |
| 389 // Number of times the tail loss probe has been sent. | 391 // Number of times the tail loss probe has been sent. |
| 390 size_t consecutive_tlp_count_; | 392 size_t consecutive_tlp_count_; |
| 391 // Number of times the crypto handshake has been retransmitted. | 393 // Number of times the crypto handshake has been retransmitted. |
| 392 size_t consecutive_crypto_retransmission_count_; | 394 size_t consecutive_crypto_retransmission_count_; |
| 393 // Number of pending transmissions of TLP or crypto packets. | 395 // Number of pending transmissions of TLP, RTO, or crypto packets. |
| 394 size_t pending_timer_transmission_count_; | 396 size_t pending_timer_transmission_count_; |
| 395 // Maximum number of tail loss probes to send before firing an RTO. | 397 // Maximum number of tail loss probes to send before firing an RTO. |
| 396 size_t max_tail_loss_probes_; | 398 size_t max_tail_loss_probes_; |
| 397 bool using_pacing_; | 399 bool using_pacing_; |
| 398 | 400 |
| 399 // Vectors packets acked and lost as a result of the last congestion event. | 401 // Vectors packets acked and lost as a result of the last congestion event. |
| 400 SendAlgorithmInterface::CongestionVector packets_acked_; | 402 SendAlgorithmInterface::CongestionVector packets_acked_; |
| 401 SendAlgorithmInterface::CongestionVector packets_lost_; | 403 SendAlgorithmInterface::CongestionVector packets_lost_; |
| 402 | 404 |
| 403 // Set to true after the crypto handshake has successfully completed. After | 405 // Set to true after the crypto handshake has successfully completed. After |
| 404 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on | 406 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on |
| 405 // the crypto stream (i.e. SCUP messages) are treated like normal | 407 // the crypto stream (i.e. SCUP messages) are treated like normal |
| 406 // retransmittable frames. | 408 // retransmittable frames. |
| 407 bool handshake_confirmed_; | 409 bool handshake_confirmed_; |
| 408 | 410 |
| 409 // Records bandwidth from server to client in normal operation, over periods | 411 // Records bandwidth from server to client in normal operation, over periods |
| 410 // of time with no loss events. | 412 // of time with no loss events. |
| 411 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; | 413 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; |
| 412 | 414 |
| 413 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 415 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
| 414 }; | 416 }; |
| 415 | 417 |
| 416 } // namespace net | 418 } // namespace net |
| 417 | 419 |
| 418 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 420 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| OLD | NEW |