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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual ~MultipathDelegateInterface() {} | 50 virtual ~MultipathDelegateInterface() {} |
51 | 51 |
52 // Called when unencrypted |packet_number| is requested to be neutered. | 52 // Called when unencrypted |packet_number| is requested to be neutered. |
53 virtual void OnUnencryptedPacketsNeutered( | 53 virtual void OnUnencryptedPacketsNeutered( |
54 QuicPathId path_id, | 54 QuicPathId path_id, |
55 QuicPacketNumber packet_number) = 0; | 55 QuicPacketNumber packet_number) = 0; |
56 // Called when |packet_number| is requested to be retransmitted. | 56 // Called when |packet_number| is requested to be retransmitted. |
57 virtual void OnRetransmissionMarked(QuicPathId path_id, | 57 virtual void OnRetransmissionMarked(QuicPathId path_id, |
58 QuicPacketNumber packet_number, | 58 QuicPacketNumber packet_number, |
59 TransmissionType transmission_type) = 0; | 59 TransmissionType transmission_type) = 0; |
60 // Called when |packet_number| is marked as not retransmittable. | |
61 virtual void OnPacketMarkedNotRetransmittable( | |
62 QuicPathId path_id, | |
63 QuicPacketNumber packet_number, | |
64 QuicTime::Delta delta_largest_observed) = 0; | |
65 // Called when any transmission of |packet_number| is handled. | 60 // Called when any transmission of |packet_number| is handled. |
66 virtual void OnPacketMarkedHandled( | 61 virtual void OnPacketMarkedHandled( |
67 QuicPathId path_id, | 62 QuicPathId path_id, |
68 QuicPacketNumber packet_number, | 63 QuicPacketNumber packet_number, |
69 QuicTime::Delta delta_largest_observed) = 0; | 64 QuicTime::Delta delta_largest_observed) = 0; |
70 }; | 65 }; |
71 | 66 |
72 QuicSentPacketManager(Perspective perspective, | 67 QuicSentPacketManager(Perspective perspective, |
73 QuicPathId path_id, | 68 QuicPathId path_id, |
74 const QuicClock* clock, | 69 const QuicClock* clock, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // Invokes OnCongestionEvent if |rtt_updated| is true, there are pending acks, | 267 // Invokes OnCongestionEvent if |rtt_updated| is true, there are pending acks, |
273 // or pending losses. Clears pending acks and pending losses afterwards. | 268 // or pending losses. Clears pending acks and pending losses afterwards. |
274 // |prior_in_flight| is the number of bytes in flight before the losses or | 269 // |prior_in_flight| is the number of bytes in flight before the losses or |
275 // acks, |event_time| is normally the timestamp of the ack packet which caused | 270 // acks, |event_time| is normally the timestamp of the ack packet which caused |
276 // the event, although it can be the time at which loss detection was | 271 // the event, although it can be the time at which loss detection was |
277 // triggered. | 272 // triggered. |
278 void MaybeInvokeCongestionEvent(bool rtt_updated, | 273 void MaybeInvokeCongestionEvent(bool rtt_updated, |
279 QuicByteCount prior_in_flight, | 274 QuicByteCount prior_in_flight, |
280 QuicTime event_time); | 275 QuicTime event_time); |
281 | 276 |
282 // Called when frames of |packet_number| has been received but the packet | |
283 // itself has not been received by the peer. Currently, this method is not | |
284 // used. | |
285 // TODO(fayang): Update the comment when multipath sent packet manager is | |
286 // landed. | |
287 // The packet needs no longer to be retransmitted, but the packet remains | |
288 // pending if it is and the congestion control does not consider the packet | |
289 // acked. | |
290 void MarkPacketNotRetransmittable(QuicPacketNumber packet_number, | |
291 QuicTime::Delta ack_delay_time); | |
292 | |
293 // Removes the retransmittability and in flight properties from the packet at | 277 // Removes the retransmittability and in flight properties from the packet at |
294 // |info| due to receipt by the peer. | 278 // |info| due to receipt by the peer. |
295 void MarkPacketHandled(QuicPacketNumber packet_number, | 279 void MarkPacketHandled(QuicPacketNumber packet_number, |
296 QuicTransmissionInfo* info, | 280 QuicTransmissionInfo* info, |
297 QuicTime::Delta ack_delay_time); | 281 QuicTime::Delta ack_delay_time); |
298 | 282 |
299 // Request that |packet_number| be retransmitted after the other pending | 283 // Request that |packet_number| be retransmitted after the other pending |
300 // retransmissions. Does not add it to the retransmissions if it's already | 284 // retransmissions. Does not add it to the retransmissions if it's already |
301 // a pending retransmission. | 285 // a pending retransmission. |
302 void MarkForRetransmission(QuicPacketNumber packet_number, | 286 void MarkForRetransmission(QuicPacketNumber packet_number, |
303 TransmissionType transmission_type); | 287 TransmissionType transmission_type); |
304 | 288 |
305 // Notify observers that packet with QuicTransmissionInfo |info| is a spurious | 289 // Notify observers that packet with QuicTransmissionInfo |info| is a spurious |
306 // retransmission. It is caller's responsibility to guarantee the packet with | 290 // retransmission. It is caller's responsibility to guarantee the packet with |
307 // QuicTransmissionInfo |info| is a spurious retransmission before calling | 291 // QuicTransmissionInfo |info| is a spurious retransmission before calling |
308 // this function. | 292 // this function. |
309 void RecordOneSpuriousRetransmission(const QuicTransmissionInfo& info); | 293 void RecordOneSpuriousRetransmission(const QuicTransmissionInfo& info); |
310 | 294 |
311 // Notify observers about spurious retransmits of packet with | 295 // Notify observers about spurious retransmits of packet with |
312 // QuicTransmissionInfo |info|. | 296 // QuicTransmissionInfo |info|. |
313 void RecordSpuriousRetransmissions(const QuicTransmissionInfo& info, | 297 void RecordSpuriousRetransmissions(const QuicTransmissionInfo& info, |
314 QuicPacketNumber acked_packet_number); | 298 QuicPacketNumber acked_packet_number); |
315 | 299 |
316 // Returns mutable QuicTransmissionInfo associated with |packet_number|, which | |
317 // must be unacked. | |
318 QuicTransmissionInfo* GetMutableTransmissionInfo( | |
319 QuicPacketNumber packet_number); | |
320 | |
321 // Remove any packets no longer needed for retransmission, congestion, or | |
322 // RTT measurement purposes. | |
323 void RemoveObsoletePackets(); | |
324 | |
325 // Sets the send algorithm to the given congestion control type and points the | 300 // Sets the send algorithm to the given congestion control type and points the |
326 // pacing sender at |send_algorithm_|. Can be called any number of times. | 301 // pacing sender at |send_algorithm_|. Can be called any number of times. |
327 void SetSendAlgorithm(CongestionControlType congestion_control_type); | 302 void SetSendAlgorithm(CongestionControlType congestion_control_type); |
328 | 303 |
329 // Sets the send algorithm to |send_algorithm| and points the pacing sender at | 304 // Sets the send algorithm to |send_algorithm| and points the pacing sender at |
330 // |send_algorithm_|. Takes ownership of |send_algorithm|. Can be called any | 305 // |send_algorithm_|. Takes ownership of |send_algorithm|. Can be called any |
331 // number of times. | 306 // number of times. |
332 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm); | 307 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm); |
333 | 308 |
334 // Newly serialized retransmittable packets are added to this map, which | 309 // Newly serialized retransmittable packets are added to this map, which |
(...skipping 23 matching lines...) Expand all Loading... |
358 DebugDelegate* debug_delegate_; | 333 DebugDelegate* debug_delegate_; |
359 NetworkChangeVisitor* network_change_visitor_; | 334 NetworkChangeVisitor* network_change_visitor_; |
360 const QuicPacketCount initial_congestion_window_; | 335 const QuicPacketCount initial_congestion_window_; |
361 RttStats rtt_stats_; | 336 RttStats rtt_stats_; |
362 std::unique_ptr<SendAlgorithmInterface> send_algorithm_; | 337 std::unique_ptr<SendAlgorithmInterface> send_algorithm_; |
363 // Not owned. Always points to |general_loss_algorithm_| outside of tests. | 338 // Not owned. Always points to |general_loss_algorithm_| outside of tests. |
364 LossDetectionInterface* loss_algorithm_; | 339 LossDetectionInterface* loss_algorithm_; |
365 GeneralLossAlgorithm general_loss_algorithm_; | 340 GeneralLossAlgorithm general_loss_algorithm_; |
366 bool n_connection_simulation_; | 341 bool n_connection_simulation_; |
367 | 342 |
368 // Receiver side buffer in bytes. | |
369 QuicByteCount receive_buffer_bytes_; | |
370 | |
371 // Least packet number which the peer is still waiting for. | 343 // Least packet number which the peer is still waiting for. |
372 QuicPacketNumber least_packet_awaited_by_peer_; | 344 QuicPacketNumber least_packet_awaited_by_peer_; |
373 | 345 |
374 // Tracks the first RTO packet. If any packet before that packet gets acked, | 346 // Tracks the first RTO packet. If any packet before that packet gets acked, |
375 // it indicates the RTO was spurious and should be reversed(F-RTO). | 347 // it indicates the RTO was spurious and should be reversed(F-RTO). |
376 QuicPacketNumber first_rto_transmission_; | 348 QuicPacketNumber first_rto_transmission_; |
377 // Number of times the RTO timer has fired in a row without receiving an ack. | 349 // Number of times the RTO timer has fired in a row without receiving an ack. |
378 size_t consecutive_rto_count_; | 350 size_t consecutive_rto_count_; |
379 // Number of times the tail loss probe has been sent. | 351 // Number of times the tail loss probe has been sent. |
380 size_t consecutive_tlp_count_; | 352 size_t consecutive_tlp_count_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // Records bandwidth from server to client in normal operation, over periods | 389 // Records bandwidth from server to client in normal operation, over periods |
418 // of time with no loss events. | 390 // of time with no loss events. |
419 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; | 391 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; |
420 | 392 |
421 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); | 393 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); |
422 }; | 394 }; |
423 | 395 |
424 } // namespace net | 396 } // namespace net |
425 | 397 |
426 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ | 398 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ |
OLD | NEW |