blob: ab83f1b9dd5eaca0a156f823e1dd56e04060056d [file] [log] [blame]
[email protected]4d1789c32013-09-18 23:54:361// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
6#define NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
7
Avi Drissman13fc8932015-12-20 04:40:468#include <stddef.h>
9
[email protected]4d1789c32013-09-18 23:54:3610#include <map>
danakjad1777e2016-04-16 00:56:4211#include <memory>
[email protected]4d1789c32013-09-18 23:54:3612#include <set>
13#include <utility>
14#include <vector>
15
Avi Drissman13fc8932015-12-20 04:40:4616#include "base/macros.h"
[email protected]4d1789c32013-09-18 23:54:3617#include "net/base/linked_hash_map.h"
[email protected]93dd91f2014-02-27 00:09:0318#include "net/quic/congestion_control/loss_detection_interface.h"
[email protected]ffc34bf2014-03-07 02:42:0219#include "net/quic/congestion_control/rtt_stats.h"
[email protected]2adef90e2013-12-02 20:26:5720#include "net/quic/congestion_control/send_algorithm_interface.h"
[email protected]4d1789c32013-09-18 23:54:3621#include "net/quic/quic_protocol.h"
[email protected]ca4e0d92014-08-22 16:33:2222#include "net/quic/quic_sustained_bandwidth_recorder.h"
[email protected]cb23a922014-02-20 17:42:3823#include "net/quic/quic_unacked_packet_map.h"
[email protected]4d1789c32013-09-18 23:54:3624
25namespace net {
26
[email protected]2adef90e2013-12-02 20:26:5727namespace test {
28class QuicConnectionPeer;
29class QuicSentPacketManagerPeer;
30} // namespace test
31
32class QuicClock;
33class QuicConfig;
[email protected]6ae6e342014-02-06 02:21:4234struct QuicConnectionStats;
[email protected]2adef90e2013-12-02 20:26:5735
36// Class which tracks the set of packets sent on a QUIC connection and contains
37// a send algorithm to decide when to send new packets. It keeps track of any
38// retransmittable data associated with each packet. If a packet is
39// retransmitted, it will keep track of each version of a packet so that if a
40// previous transmission is acked, the data will not be retransmitted.
[email protected]4d1789c32013-09-18 23:54:3641class NET_EXPORT_PRIVATE QuicSentPacketManager {
42 public:
jric533399b2016-01-29 07:36:0143 // A delegate interface which manages pending retransmissions.
44 class MultipathDelegateInterface {
45 public:
46 virtual ~MultipathDelegateInterface() {}
47
48 // Called when unencrypted |packet_number| is requested to be neutered.
49 virtual void OnUnencryptedPacketsNeutered(
50 QuicPathId path_id,
51 QuicPacketNumber packet_number) = 0;
52 // Called when |packet_number| is requested to be retransmitted.
53 virtual void OnRetransmissionMarked(QuicPathId path_id,
54 QuicPacketNumber packet_number,
55 TransmissionType transmission_type) = 0;
56 // Called when |packet_number| is marked as not retransmittable.
57 virtual void OnPacketMarkedNotRetransmittable(
58 QuicPathId path_id,
59 QuicPacketNumber packet_number,
60 QuicTime::Delta delta_largest_observed) = 0;
61 // Called when any transmission of |packet_number| is handled.
62 virtual void OnPacketMarkedHandled(
63 QuicPathId path_id,
64 QuicPacketNumber packet_number,
65 QuicTime::Delta delta_largest_observed) = 0;
66 };
67
[email protected]730b35d72014-06-05 03:23:2268 // Interface which gets callbacks from the QuicSentPacketManager at
69 // interesting points. Implementations must not mutate the state of
70 // the packet manager or connection as a result of these callbacks.
71 class NET_EXPORT_PRIVATE DebugDelegate {
72 public:
73 virtual ~DebugDelegate() {}
74
75 // Called when a spurious retransmission is detected.
rtenneti5d9c02c2015-01-16 00:45:3276 virtual void OnSpuriousPacketRetransmission(
[email protected]730b35d72014-06-05 03:23:2277 TransmissionType transmission_type,
78 QuicByteCount byte_size) {}
[email protected]ccb34212014-07-18 09:27:5079
rtennetia004d332015-08-28 06:44:5780 virtual void OnIncomingAck(const QuicAckFrame& ack_frame,
81 QuicTime ack_receive_time,
82 QuicPacketNumber largest_observed,
83 bool rtt_updated,
84 QuicPacketNumber least_unacked_sent_packet) {}
rchcaec4242016-01-22 20:49:5285
86 virtual void OnPacketLoss(QuicPacketNumber lost_packet_number,
87 TransmissionType transmission_type,
88 QuicTime detection_time) {}
[email protected]730b35d72014-06-05 03:23:2289 };
90
[email protected]a692ad9d2014-07-18 21:35:2491 // Interface which gets callbacks from the QuicSentPacketManager when
92 // network-related state changes. Implementations must not mutate the
93 // state of the packet manager as a result of these callbacks.
94 class NET_EXPORT_PRIVATE NetworkChangeVisitor {
95 public:
96 virtual ~NetworkChangeVisitor() {}
97
ckrasica7fd1242016-05-14 20:36:0198 // Called when congestion window or RTT may have changed.
99 virtual void OnCongestionChange() = 0;
jriaeec2fb2016-02-05 02:05:36100
101 // Called with the path may be degrading. Note that the path may only be
102 // temporarily degrading.
103 // TODO(jri): With multipath, this method should probably have a path_id
104 // parameter, and should maybe result in the path being marked as inactive.
105 virtual void OnPathDegrading() = 0;
[email protected]a692ad9d2014-07-18 21:35:24106 };
107
rtenneti6f48aa92015-03-16 02:18:48108 QuicSentPacketManager(Perspective perspective,
fayanga31a74b2015-12-28 17:27:14109 QuicPathId path_id,
[email protected]2adef90e2013-12-02 20:26:57110 const QuicClock* clock,
[email protected]6ae6e342014-02-06 02:21:42111 QuicConnectionStats* stats,
[email protected]a692ad9d2014-07-18 21:35:24112 CongestionControlType congestion_control_type,
jric533399b2016-01-29 07:36:01113 LossDetectionType loss_type,
114 MultipathDelegateInterface* delegate);
[email protected]4d1789c32013-09-18 23:54:36115 virtual ~QuicSentPacketManager();
116
[email protected]2adef90e2013-12-02 20:26:57117 virtual void SetFromConfig(const QuicConfig& config);
118
rtenneti85d89712014-11-20 03:32:24119 // Pass the CachedNetworkParameters to the send algorithm.
rtenneti581b6ae82015-07-20 20:48:01120 void ResumeConnectionState(
rtennetib346cb02015-03-25 19:50:06121 const CachedNetworkParameters& cached_network_params,
122 bool max_bandwidth_resumption);
rtenneti85d89712014-11-20 03:32:24123
rtenneti33da8ab2014-11-04 04:17:00124 void SetNumOpenStreams(size_t num_streams);
125
alyssar2adf3ac2016-05-03 17:12:58126 void SetMaxPacingRate(QuicBandwidth max_pacing_rate);
127
[email protected]9693157b2014-08-08 11:13:49128 void SetHandshakeConfirmed() { handshake_confirmed_ = true; }
129
[email protected]257f24f2014-04-01 09:15:37130 // Processes the incoming ack.
rjshaded5ced072015-12-18 19:26:02131 void OnIncomingAck(const QuicAckFrame& ack_frame, QuicTime ack_receive_time);
[email protected]4d1789c32013-09-18 23:54:36132
rjshaded069aaee2016-03-11 20:42:17133 // Returns true if packet |packet_number| is unacked.
rtennetia004d332015-08-28 06:44:57134 bool IsUnacked(QuicPacketNumber packet_number) const;
[email protected]4d1789c32013-09-18 23:54:36135
[email protected]41fb6372013-12-10 05:26:40136 // Requests retransmission of all unacked packets of |retransmission_type|.
rtenneti85d89712014-11-20 03:32:24137 // The behavior of this method depends on the value of |retransmission_type|:
138 // ALL_UNACKED_RETRANSMISSION - All unacked packets will be retransmitted.
139 // This can happen, for example, after a version negotiation packet has been
140 // received and all packets needs to be retransmitted with the new version.
141 // ALL_INITIAL_RETRANSMISSION - Only initially encrypted packets will be
142 // retransmitted. This can happen, for example, when a CHLO has been rejected
143 // and the previously encrypted data needs to be encrypted with a new key.
rtenneti31e9fd62014-09-16 05:22:15144 void RetransmitUnackedPackets(TransmissionType retransmission_type);
[email protected]4d1789c32013-09-18 23:54:36145
[email protected]d8bbef62014-06-12 08:02:50146 // Retransmits the oldest pending packet there is still a tail loss probe
147 // pending. Invoked after OnRetransmissionTimeout.
148 bool MaybeRetransmitTailLossProbe();
149
[email protected]82168ee22014-04-30 22:25:48150 // Removes the retransmittable frames from all unencrypted packets to ensure
151 // they don't get retransmitted.
[email protected]6d9ca3b72014-05-13 07:44:22152 void NeuterUnencryptedPackets();
[email protected]82168ee22014-04-30 22:25:48153
rtennetia004d332015-08-28 06:44:57154 // Returns true if the unacked packet |packet_number| has retransmittable
[email protected]c67a82cb2013-09-24 02:53:21155 // frames. This will only return false if the packet has been acked, if a
156 // previous transmission of this packet was ACK'd, or if this packet has been
rtennetia004d332015-08-28 06:44:57157 // retransmitted as with different packet number.
158 bool HasRetransmittableFrames(QuicPacketNumber packet_number) const;
[email protected]c67a82cb2013-09-24 02:53:21159
[email protected]45a3e152013-09-25 16:35:11160 // Returns true if there are pending retransmissions.
danzh1401f0a2016-05-19 13:41:10161 // Not const because retransmissions may be cancelled before returning.
[email protected]45a3e152013-09-25 16:35:11162 bool HasPendingRetransmissions() const;
163
rtennetifbf7d6b2015-01-05 23:45:36164 // Retrieves the next pending retransmission. You must ensure that
165 // there are pending retransmissions prior to calling this function.
[email protected]45a3e152013-09-25 16:35:11166 PendingRetransmission NextPendingRetransmission();
[email protected]4d1789c32013-09-18 23:54:36167
[email protected]4d1789c32013-09-18 23:54:36168 bool HasUnackedPackets() const;
169
rtennetia004d332015-08-28 06:44:57170 // Returns the smallest packet number of a serialized packet which has not
rtenneti16142b62014-09-03 21:52:11171 // been acked by the peer.
rtennetia004d332015-08-28 06:44:57172 QuicPacketNumber GetLeastUnacked() const;
[email protected]4d1789c32013-09-18 23:54:36173
[email protected]2adef90e2013-12-02 20:26:57174 // Called when we have sent bytes to the peer. This informs the manager both
[email protected]2115d33ba2014-01-02 21:53:52175 // the number of bytes sent and if they were retransmitted. Returns true if
176 // the sender should reset the retransmission timer.
rtennetia4dcff92014-09-29 18:16:08177 virtual bool OnPacketSent(SerializedPacket* serialized_packet,
ckrasica7fd1242016-05-14 20:36:01178 QuicPathId /*original_path_id*/,
rtennetia004d332015-08-28 06:44:57179 QuicPacketNumber original_packet_number,
[email protected]2adef90e2013-12-02 20:26:57180 QuicTime sent_time,
[email protected]2adef90e2013-12-02 20:26:57181 TransmissionType transmission_type,
182 HasRetransmittableData has_retransmittable_data);
183
184 // Called when the retransmission timer expires.
185 virtual void OnRetransmissionTimeout();
186
[email protected]2adef90e2013-12-02 20:26:57187 // Calculate the time until we can send the next packet to the wire.
188 // Note 1: When kUnknownWaitTime is returned, there is no need to poll
189 // TimeUntilSend again until we receive an OnIncomingAckFrame event.
190 // Note 2: Send algorithms may or may not use |retransmit| in their
191 // calculations.
192 virtual QuicTime::Delta TimeUntilSend(QuicTime now,
[email protected]9bb57c72014-03-31 20:36:04193 HasRetransmittableData retransmittable);
[email protected]2adef90e2013-12-02 20:26:57194
[email protected]2adef90e2013-12-02 20:26:57195 // Returns amount of time for delayed ack timer.
[email protected]2115d33ba2014-01-02 21:53:52196 const QuicTime::Delta DelayedAckTime() const;
[email protected]2adef90e2013-12-02 20:26:57197
[email protected]c0680202013-12-18 04:52:34198 // Returns the current delay for the retransmission timer, which may send
[email protected]2115d33ba2014-01-02 21:53:52199 // either a tail loss probe or do a full RTO. Returns QuicTime::Zero() if
200 // there are no retransmittable packets.
[email protected]c0680202013-12-18 04:52:34201 const QuicTime GetRetransmissionTime() const;
202
[email protected]fb35b0a2014-04-15 21:06:49203 const RttStats* GetRttStats() const;
[email protected]2adef90e2013-12-02 20:26:57204
205 // Returns the estimated bandwidth calculated by the congestion algorithm.
206 QuicBandwidth BandwidthEstimate() const;
207
[email protected]ca4e0d92014-08-22 16:33:22208 const QuicSustainedBandwidthRecorder& SustainedBandwidthRecorder() const;
209
rtenneti4a5df262014-11-07 00:43:58210 // Returns the size of the current congestion window in number of
211 // kDefaultTCPMSS-sized segments. Note, this is not the *available* window.
212 // Some send algorithms may not use a congestion window and will return 0.
213 QuicPacketCount GetCongestionWindowInTcpMss() const;
[email protected]2adef90e2013-12-02 20:26:57214
rtenneti4a5df262014-11-07 00:43:58215 // Returns the number of packets of length |max_packet_length| which fit in
216 // the current congestion window. More packets may end up in flight if the
217 // congestion window has been recently reduced, of if non-full packets are
218 // sent.
219 QuicPacketCount EstimateMaxPacketsInFlight(
220 QuicByteCount max_packet_length) const;
221
rtenneti9bd5d4b2015-08-21 05:44:52222 // Returns the size of the current congestion window size in bytes.
223 QuicByteCount GetCongestionWindowInBytes() const;
224
rtenneti4a5df262014-11-07 00:43:58225 // Returns the size of the slow start congestion window in nume of 1460 byte
226 // TCP segments, aka ssthresh. Some send algorithms do not define a slow
227 // start threshold and will return 0.
228 QuicPacketCount GetSlowStartThresholdInTcpMss() const;
[email protected]ccb34212014-07-18 09:27:50229
rtennetifb3fa6c2015-03-16 23:04:55230 // No longer retransmit data for |stream_id|.
231 void CancelRetransmissionsForStream(QuicStreamId stream_id);
232
[email protected]2f9fb932014-08-20 19:42:44233 // Enables pacing if it has not already been enabled.
234 void EnablePacing();
[email protected]2adef90e2013-12-02 20:26:57235
rjshadec86dbfa2015-11-12 20:16:25236 // Called when peer address changes and the connection migrates.
237 void OnConnectionMigration(PeerAddressChangeType type);
238
[email protected]2adef90e2013-12-02 20:26:57239 bool using_pacing() const { return using_pacing_; }
240
ckrasica7fd1242016-05-14 20:36:01241 bool handshake_confirmed() const { return handshake_confirmed_; }
242
[email protected]730b35d72014-06-05 03:23:22243 void set_debug_delegate(DebugDelegate* debug_delegate) {
244 debug_delegate_ = debug_delegate;
245 }
246
rtennetia004d332015-08-28 06:44:57247 QuicPacketNumber largest_observed() const {
[email protected]ca4e0d92014-08-22 16:33:22248 return unacked_packets_.largest_observed();
249 }
250
rtennetia8fb60cb2015-09-10 18:17:57251 QuicPacketNumber largest_sent_packet() const {
252 return unacked_packets_.largest_sent_packet();
253 }
254
255 QuicPacketNumber least_packet_awaited_by_peer() const {
[email protected]ca4e0d92014-08-22 16:33:22256 return least_packet_awaited_by_peer_;
[email protected]0c6b10ad2014-07-02 19:47:00257 }
258
[email protected]a692ad9d2014-07-18 21:35:24259 void set_network_change_visitor(NetworkChangeVisitor* visitor) {
260 DCHECK(!network_change_visitor_);
261 DCHECK(visitor);
262 network_change_visitor_ = visitor;
263 }
264
rchcaec4242016-01-22 20:49:52265 bool InSlowStart() const;
266
rtennetiae5ac432015-03-03 06:36:50267 // Used in Chromium, but not in the server.
rjshaded5ced072015-12-18 19:26:02268 size_t consecutive_rto_count() const { return consecutive_rto_count_; }
[email protected]d117e5282014-08-16 06:18:54269
rtennetiae5ac432015-03-03 06:36:50270 // Used in Chromium, but not in the server.
rjshaded5ced072015-12-18 19:26:02271 size_t consecutive_tlp_count() const { return consecutive_tlp_count_; }
[email protected]d117e5282014-08-16 06:18:54272
[email protected]4d1789c32013-09-18 23:54:36273 private:
[email protected]2adef90e2013-12-02 20:26:57274 friend class test::QuicConnectionPeer;
275 friend class test::QuicSentPacketManagerPeer;
276
[email protected]3aa9ca72014-02-27 19:39:43277 // The retransmission timer is a single timer which switches modes depending
278 // upon connection state.
[email protected]066d8182014-01-04 02:02:45279 enum RetransmissionTimeoutMode {
[email protected]3aa9ca72014-02-27 19:39:43280 // A conventional TCP style RTO.
[email protected]066d8182014-01-04 02:02:45281 RTO_MODE,
[email protected]3aa9ca72014-02-27 19:39:43282 // A tail loss probe. By default, QUIC sends up to two before RTOing.
[email protected]066d8182014-01-04 02:02:45283 TLP_MODE,
[email protected]3aa9ca72014-02-27 19:39:43284 // Retransmission of handshake packets prior to handshake completion.
[email protected]066d8182014-01-04 02:02:45285 HANDSHAKE_MODE,
[email protected]3aa9ca72014-02-27 19:39:43286 // Re-invoke the loss detection when a packet is not acked before the
287 // loss detection algorithm expects.
288 LOSS_MODE,
[email protected]066d8182014-01-04 02:02:45289 };
290
rtennetia004d332015-08-28 06:44:57291 typedef linked_hash_map<QuicPacketNumber, TransmissionType>
292 PendingRetransmissionMap;
[email protected]c67a82cb2013-09-24 02:53:21293
[email protected]ca4e0d92014-08-22 16:33:22294 // Updates the least_packet_awaited_by_peer.
295 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& ack_frame);
296
[email protected]c67a82cb2013-09-24 02:53:21297 // Process the incoming ack looking for newly ack'd data packets.
[email protected]310d37b2014-08-02 06:15:37298 void HandleAckForSentPackets(const QuicAckFrame& ack_frame);
[email protected]c67a82cb2013-09-24 02:53:21299
[email protected]066d8182014-01-04 02:02:45300 // Returns the current retransmission mode.
301 RetransmissionTimeoutMode GetRetransmissionMode() const;
302
303 // Retransmits all crypto stream packets.
304 void RetransmitCryptoPackets();
305
rtenneti5d9c02c2015-01-16 00:45:32306 // Retransmits two packets for an RTO and removes any non-retransmittable
307 // packets from flight.
308 void RetransmitRtoPackets();
309
[email protected]066d8182014-01-04 02:02:45310 // Returns the timer for retransmitting crypto handshake packets.
311 const QuicTime::Delta GetCryptoRetransmissionDelay() const;
312
313 // Returns the timer for a new tail loss probe.
314 const QuicTime::Delta GetTailLossProbeDelay() const;
315
316 // Returns the retransmission timeout, after which a full RTO occurs.
317 const QuicTime::Delta GetRetransmissionDelay() const;
318
zhongyi1fb9bc52015-11-24 23:09:42319 // Returns the newest transmission associated with a packet.
320 QuicPacketNumber GetNewestRetransmission(
321 QuicPacketNumber packet_number,
322 const TransmissionInfo& transmission_info) const;
323
rtennetia004d332015-08-28 06:44:57324 // Update the RTT if the ack is for the largest acked packet number.
[email protected]77b5d50b2014-05-07 22:48:48325 // Returns true if the rtt was updated.
fnkf57804c2016-03-17 20:57:07326 bool MaybeUpdateRTT(const QuicAckFrame& ack_frame, QuicTime ack_receive_time);
[email protected]41fb6372013-12-10 05:26:40327
[email protected]93dd91f2014-02-27 00:09:03328 // Invokes the loss detection algorithm and loses and retransmits packets if
329 // necessary.
330 void InvokeLossDetection(QuicTime time);
331
[email protected]77b5d50b2014-05-07 22:48:48332 // Invokes OnCongestionEvent if |rtt_updated| is true, there are pending acks,
333 // or pending losses. Clears pending acks and pending losses afterwards.
334 // |bytes_in_flight| is the number of bytes in flight before the losses or
335 // acks.
336 void MaybeInvokeCongestionEvent(bool rtt_updated,
337 QuicByteCount bytes_in_flight);
338
jric533399b2016-01-29 07:36:01339 // Called when frames of |packet_number| has been received but the packet
rjshaded069aaee2016-03-11 20:42:17340 // itself has not been received by the peer. Currently, this method is not
341 // used.
342 // TODO(fayang): Update the comment when multipath sent packet manager is
343 // landed.
jric533399b2016-01-29 07:36:01344 // The packet needs no longer to be retransmitted, but the packet remains
345 // pending if it is and the congestion control does not consider the packet
346 // acked.
347 void MarkPacketNotRetransmittable(QuicPacketNumber packet_number,
348 QuicTime::Delta ack_delay_time);
[email protected]2d43c40122014-04-21 14:51:27349
zhongyi1fb9bc52015-11-24 23:09:42350 // Removes the retransmittability and in flight properties from the packet at
351 // |info| due to receipt by the peer.
rtennetia004d332015-08-28 06:44:57352 void MarkPacketHandled(QuicPacketNumber packet_number,
zhongyi1fb9bc52015-11-24 23:09:42353 TransmissionInfo* info,
rchcaec4242016-01-22 20:49:52354 QuicTime::Delta ack_delay_time);
[email protected]c0680202013-12-18 04:52:34355
rtennetia004d332015-08-28 06:44:57356 // Request that |packet_number| be retransmitted after the other pending
[email protected]c0680202013-12-18 04:52:34357 // retransmissions. Does not add it to the retransmissions if it's already
358 // a pending retransmission.
rtennetia004d332015-08-28 06:44:57359 void MarkForRetransmission(QuicPacketNumber packet_number,
[email protected]41fb6372013-12-10 05:26:40360 TransmissionType transmission_type);
361
zhongyi4a9d27b2016-01-12 20:08:31362 // Notify observers that packet with TransmissionInfo |info| is a spurious
363 // retransmission. It is caller's responsibility to guarantee the packet with
364 // TransmissionInfo |info| is a spurious retransmission before calling this
365 // function.
366 void RecordOneSpuriousRetransmission(const TransmissionInfo& info);
367
368 // Notify observers about spurious retransmits of packet with TransmissionInfo
369 // |info|.
zhongyi1fb9bc52015-11-24 23:09:42370 void RecordSpuriousRetransmissions(const TransmissionInfo& info,
rtennetia004d332015-08-28 06:44:57371 QuicPacketNumber acked_packet_number);
[email protected]730b35d72014-06-05 03:23:22372
jric533399b2016-01-29 07:36:01373 // Returns mutable TransmissionInfo associated with |packet_number|, which
374 // must be unacked.
375 TransmissionInfo* GetMutableTransmissionInfo(QuicPacketNumber packet_number);
376
377 // Remove any packets no longer needed for retransmission, congestion, or
378 // RTT measurement purposes.
379 void RemoveObsoletePackets();
380
rjshaded069aaee2016-03-11 20:42:17381 // Newly serialized retransmittable packets are added to this map, which
382 // contains owning pointers to any contained frames. If a packet is
[email protected]457d6952013-12-13 09:24:58383 // retransmitted, this map will contain entries for both the old and the new
rtennetibe6357372014-10-02 22:51:42384 // packet. The old packet's retransmittable frames entry will be nullptr,
385 // while the new packet's entry will contain the frames to retransmit.
[email protected]c67a82cb2013-09-24 02:53:21386 // If the old packet is acked before the new packet, then the old entry will
387 // be removed from the map and the new entry's retransmittable frames will be
rtennetibe6357372014-10-02 22:51:42388 // set to nullptr.
[email protected]cb23a922014-02-20 17:42:38389 QuicUnackedPacketMap unacked_packets_;
[email protected]4d1789c32013-09-18 23:54:36390
[email protected]45a3e152013-09-25 16:35:11391 // Pending retransmissions which have not been packetized and sent yet.
392 PendingRetransmissionMap pending_retransmissions_;
393
rtenneti6f48aa92015-03-16 02:18:48394 // Tracks if the connection was created by the server or the client.
395 Perspective perspective_;
[email protected]c67a82cb2013-09-24 02:53:21396
fayanga31a74b2015-12-28 17:27:14397 QuicPathId path_id_;
398
[email protected]2adef90e2013-12-02 20:26:57399 const QuicClock* clock_;
[email protected]6ae6e342014-02-06 02:21:42400 QuicConnectionStats* stats_;
jric533399b2016-01-29 07:36:01401
402 // Pending retransmissions are managed by delegate_ if it is not null.
403 MultipathDelegateInterface* delegate_; // Not owned.
404
[email protected]730b35d72014-06-05 03:23:22405 DebugDelegate* debug_delegate_;
[email protected]a692ad9d2014-07-18 21:35:24406 NetworkChangeVisitor* network_change_visitor_;
rtenneti3fe4ebbc2014-11-16 16:43:47407 const QuicPacketCount initial_congestion_window_;
[email protected]ffc34bf2014-03-07 02:42:02408 RttStats rtt_stats_;
danakjad1777e2016-04-16 00:56:42409 std::unique_ptr<SendAlgorithmInterface> send_algorithm_;
410 std::unique_ptr<LossDetectionInterface> loss_algorithm_;
rtenneti33da8ab2014-11-04 04:17:00411 bool n_connection_simulation_;
[email protected]ffc34bf2014-03-07 02:42:02412
rtenneti23186682014-10-30 01:49:33413 // Receiver side buffer in bytes.
414 QuicByteCount receive_buffer_bytes_;
415
rtennetia004d332015-08-28 06:44:57416 // Least packet number which the peer is still waiting for.
417 QuicPacketNumber least_packet_awaited_by_peer_;
[email protected]cc1aa272014-06-30 19:48:22418
419 // Tracks the first RTO packet. If any packet before that packet gets acked,
420 // it indicates the RTO was spurious and should be reversed(F-RTO).
rtennetia004d332015-08-28 06:44:57421 QuicPacketNumber first_rto_transmission_;
[email protected]2adef90e2013-12-02 20:26:57422 // Number of times the RTO timer has fired in a row without receiving an ack.
423 size_t consecutive_rto_count_;
[email protected]066d8182014-01-04 02:02:45424 // Number of times the tail loss probe has been sent.
425 size_t consecutive_tlp_count_;
426 // Number of times the crypto handshake has been retransmitted.
427 size_t consecutive_crypto_retransmission_count_;
rtenneti5d9c02c2015-01-16 00:45:32428 // Number of pending transmissions of TLP, RTO, or crypto packets.
[email protected]2f9fb932014-08-20 19:42:44429 size_t pending_timer_transmission_count_;
[email protected]066d8182014-01-04 02:02:45430 // Maximum number of tail loss probes to send before firing an RTO.
431 size_t max_tail_loss_probes_;
rtennetif8a6a212015-08-24 20:13:16432 // If true, send the TLP at 0.5 RTT.
433 bool enable_half_rtt_tail_loss_probe_;
[email protected]2adef90e2013-12-02 20:26:57434 bool using_pacing_;
rtenneticf54a52c2015-01-26 17:01:54435 // If true, use the new RTO with loss based CWND reduction instead of the send
436 // algorithms's OnRetransmissionTimeout to reduce the congestion window.
437 bool use_new_rto_;
danzh1401f0a2016-05-19 13:41:10438 // If true, cancel pending retransmissions if they're larger than
439 // largest_newly_acked.
440 bool undo_pending_retransmits_;
[email protected]2adef90e2013-12-02 20:26:57441
rtenneti16142b62014-09-03 21:52:11442 // Vectors packets acked and lost as a result of the last congestion event.
443 SendAlgorithmInterface::CongestionVector packets_acked_;
444 SendAlgorithmInterface::CongestionVector packets_lost_;
alyssarc2f70a52016-05-04 13:15:49445 // Largest newly acknowledged packet.
446 QuicPacketNumber largest_newly_acked_;
[email protected]77b5d50b2014-05-07 22:48:48447
[email protected]9693157b2014-08-08 11:13:49448 // Set to true after the crypto handshake has successfully completed. After
449 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on
450 // the crypto stream (i.e. SCUP messages) are treated like normal
451 // retransmittable frames.
452 bool handshake_confirmed_;
453
[email protected]ca4e0d92014-08-22 16:33:22454 // Records bandwidth from server to client in normal operation, over periods
455 // of time with no loss events.
456 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_;
457
[email protected]4d1789c32013-09-18 23:54:36458 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager);
459};
460
461} // namespace net
462
463#endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_