| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const QuicClock* clock, | 108 const QuicClock* clock, |
| 109 QuicConnectionStats* stats, | 109 QuicConnectionStats* stats, |
| 110 CongestionControlType congestion_control_type, | 110 CongestionControlType congestion_control_type, |
| 111 LossDetectionType loss_type); | 111 LossDetectionType loss_type); |
| 112 virtual ~QuicSentPacketManager(); | 112 virtual ~QuicSentPacketManager(); |
| 113 | 113 |
| 114 virtual void SetFromConfig(const QuicConfig& config); | 114 virtual void SetFromConfig(const QuicConfig& config); |
| 115 | 115 |
| 116 void SetHandshakeConfirmed() { handshake_confirmed_ = true; } | 116 void SetHandshakeConfirmed() { handshake_confirmed_ = true; } |
| 117 | 117 |
| 118 // Called when a new packet is serialized. If the packet contains | |
| 119 // retransmittable data, it will be added to the unacked packet map. | |
| 120 void OnSerializedPacket(const SerializedPacket& serialized_packet); | |
| 121 | |
| 122 // Called when a packet is retransmitted with a new sequence number. | |
| 123 // Replaces the old entry in the unacked packet map with the new | |
| 124 // sequence number. | |
| 125 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, | |
| 126 QuicPacketSequenceNumber new_sequence_number); | |
| 127 | |
| 128 // Processes the incoming ack. | 118 // Processes the incoming ack. |
| 129 void OnIncomingAck(const QuicAckFrame& ack_frame, | 119 void OnIncomingAck(const QuicAckFrame& ack_frame, |
| 130 QuicTime ack_receive_time); | 120 QuicTime ack_receive_time); |
| 131 | 121 |
| 132 // Returns true if the non-FEC packet |sequence_number| is unacked. | 122 // Returns true if the non-FEC packet |sequence_number| is unacked. |
| 133 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; | 123 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; |
| 134 | 124 |
| 135 // Requests retransmission of all unacked packets of |retransmission_type|. | 125 // Requests retransmission of all unacked packets of |retransmission_type|. |
| 136 void RetransmitUnackedPackets(TransmissionType retransmission_type); | 126 void RetransmitUnackedPackets(TransmissionType retransmission_type); |
| 137 | 127 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 162 QuicPacketSequenceNumber GetLeastUnacked() const; | 152 QuicPacketSequenceNumber GetLeastUnacked() const; |
| 163 | 153 |
| 164 // Called when a congestion feedback frame is received from peer. | 154 // Called when a congestion feedback frame is received from peer. |
| 165 virtual void OnIncomingQuicCongestionFeedbackFrame( | 155 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 166 const QuicCongestionFeedbackFrame& frame, | 156 const QuicCongestionFeedbackFrame& frame, |
| 167 const QuicTime& feedback_receive_time); | 157 const QuicTime& feedback_receive_time); |
| 168 | 158 |
| 169 // 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 |
| 170 // 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 |
| 171 // the sender should reset the retransmission timer. | 161 // the sender should reset the retransmission timer. |
| 172 virtual bool OnPacketSent(QuicPacketSequenceNumber sequence_number, | 162 virtual bool OnPacketSent(SerializedPacket* serialized_packet, |
| 163 QuicPacketSequenceNumber original_sequence_number, |
| 173 QuicTime sent_time, | 164 QuicTime sent_time, |
| 174 QuicByteCount bytes, | 165 QuicByteCount bytes, |
| 175 TransmissionType transmission_type, | 166 TransmissionType transmission_type, |
| 176 HasRetransmittableData has_retransmittable_data); | 167 HasRetransmittableData has_retransmittable_data); |
| 177 | 168 |
| 178 // Called when the retransmission timer expires. | 169 // Called when the retransmission timer expires. |
| 179 virtual void OnRetransmissionTimeout(); | 170 virtual void OnRetransmissionTimeout(); |
| 180 | 171 |
| 181 // Calculate the time until we can send the next packet to the wire. | 172 // Calculate the time until we can send the next packet to the wire. |
| 182 // Note 1: When kUnknownWaitTime is returned, there is no need to poll | 173 // Note 1: When kUnknownWaitTime is returned, there is no need to poll |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // Retransmission of handshake packets prior to handshake completion. | 250 // Retransmission of handshake packets prior to handshake completion. |
| 260 HANDSHAKE_MODE, | 251 HANDSHAKE_MODE, |
| 261 // Re-invoke the loss detection when a packet is not acked before the | 252 // Re-invoke the loss detection when a packet is not acked before the |
| 262 // loss detection algorithm expects. | 253 // loss detection algorithm expects. |
| 263 LOSS_MODE, | 254 LOSS_MODE, |
| 264 }; | 255 }; |
| 265 | 256 |
| 266 typedef linked_hash_map<QuicPacketSequenceNumber, | 257 typedef linked_hash_map<QuicPacketSequenceNumber, |
| 267 TransmissionType> PendingRetransmissionMap; | 258 TransmissionType> PendingRetransmissionMap; |
| 268 | 259 |
| 260 // Called when a new packet is serialized. If the packet contains |
| 261 // retransmittable data, it will be added to the unacked packet map. |
| 262 void OnSerializedPacket(const SerializedPacket& serialized_packet); |
| 263 |
| 264 // Called when a packet is retransmitted with a new sequence number. |
| 265 // Replaces the old entry in the unacked packet map with the new |
| 266 // sequence number. |
| 267 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, |
| 268 QuicPacketSequenceNumber new_sequence_number); |
| 269 |
| 269 // Updates the least_packet_awaited_by_peer. | 270 // Updates the least_packet_awaited_by_peer. |
| 270 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& ack_frame); | 271 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& ack_frame); |
| 271 | 272 |
| 272 // Process the incoming ack looking for newly ack'd data packets. | 273 // Process the incoming ack looking for newly ack'd data packets. |
| 273 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); | 274 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); |
| 274 | 275 |
| 275 // Returns the current retransmission mode. | 276 // Returns the current retransmission mode. |
| 276 RetransmissionTimeoutMode GetRetransmissionMode() const; | 277 RetransmissionTimeoutMode GetRetransmissionMode() const; |
| 277 | 278 |
| 278 // Retransmits all crypto stream packets. | 279 // Retransmits all crypto stream packets. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // Records bandwidth from server to client in normal operation, over periods | 391 // Records bandwidth from server to client in normal operation, over periods |
| 391 // of time with no loss events. | 392 // of time with no loss events. |
| 392 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; | 393 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; |
| 393 | 394 |
| 394 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 395 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
| 395 }; | 396 }; |
| 396 | 397 |
| 397 } // namespace net | 398 } // namespace net |
| 398 | 399 |
| 399 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 400 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
| OLD | NEW |