Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: net/quic/core/quic_sent_packet_manager.h

Issue 2236973002: Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: flip quic_sequencer_buffer_retire_block_in_time to true Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "net/base/linked_hash_map.h" 17 #include "net/base/linked_hash_map.h"
18 #include "net/quic/core/congestion_control/general_loss_algorithm.h"
18 #include "net/quic/core/congestion_control/loss_detection_interface.h" 19 #include "net/quic/core/congestion_control/loss_detection_interface.h"
19 #include "net/quic/core/congestion_control/pacing_sender.h" 20 #include "net/quic/core/congestion_control/pacing_sender.h"
20 #include "net/quic/core/congestion_control/rtt_stats.h" 21 #include "net/quic/core/congestion_control/rtt_stats.h"
21 #include "net/quic/core/congestion_control/send_algorithm_interface.h" 22 #include "net/quic/core/congestion_control/send_algorithm_interface.h"
22 #include "net/quic/core/quic_protocol.h" 23 #include "net/quic/core/quic_protocol.h"
23 #include "net/quic/core/quic_sent_packet_manager_interface.h" 24 #include "net/quic/core/quic_sent_packet_manager_interface.h"
24 #include "net/quic/core/quic_unacked_packet_map.h" 25 #include "net/quic/core/quic_unacked_packet_map.h"
25 26
26 namespace net { 27 namespace net {
27 28
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 QuicByteCount max_packet_length) const override; 173 QuicByteCount max_packet_length) const override;
173 174
174 // Returns the size of the current congestion window size in bytes. 175 // Returns the size of the current congestion window size in bytes.
175 QuicByteCount GetCongestionWindowInBytes() const override; 176 QuicByteCount GetCongestionWindowInBytes() const override;
176 177
177 // Returns the size of the slow start congestion window in nume of 1460 byte 178 // Returns the size of the slow start congestion window in nume of 1460 byte
178 // TCP segments, aka ssthresh. Some send algorithms do not define a slow 179 // TCP segments, aka ssthresh. Some send algorithms do not define a slow
179 // start threshold and will return 0. 180 // start threshold and will return 0.
180 QuicPacketCount GetSlowStartThresholdInTcpMss() const override; 181 QuicPacketCount GetSlowStartThresholdInTcpMss() const override;
181 182
183 // Returns debugging information about the state of the congestion controller.
184 std::string GetDebugState() const override;
185
182 // No longer retransmit data for |stream_id|. 186 // No longer retransmit data for |stream_id|.
183 void CancelRetransmissionsForStream(QuicStreamId stream_id) override; 187 void CancelRetransmissionsForStream(QuicStreamId stream_id) override;
184 188
185 // Called when peer address changes and the connection migrates. 189 // Called when peer address changes and the connection migrates.
186 void OnConnectionMigration(QuicPathId, PeerAddressChangeType type) override; 190 void OnConnectionMigration(QuicPathId, PeerAddressChangeType type) override;
187 191
188 bool IsHandshakeConfirmed() const override; 192 bool IsHandshakeConfirmed() const override;
189 193
190 void SetDebugDelegate(DebugDelegate* debug_delegate) override; 194 void SetDebugDelegate(DebugDelegate* debug_delegate) override;
191 195
192 QuicPacketNumber GetLargestObserved(QuicPathId) const override; 196 QuicPacketNumber GetLargestObserved(QuicPathId) const override;
193 197
194 QuicPacketNumber GetLargestSentPacket(QuicPathId) const override; 198 QuicPacketNumber GetLargestSentPacket(QuicPathId) const override;
195 199
196 QuicPacketNumber GetLeastPacketAwaitedByPeer(QuicPathId) const override; 200 QuicPacketNumber GetLeastPacketAwaitedByPeer(QuicPathId) const override;
197 201
198 void SetNetworkChangeVisitor(NetworkChangeVisitor* visitor) override; 202 void SetNetworkChangeVisitor(NetworkChangeVisitor* visitor) override;
199 203
200 bool InSlowStart() const override; 204 bool InSlowStart() const override;
201 205
202 size_t GetConsecutiveRtoCount() const override; 206 size_t GetConsecutiveRtoCount() const override;
203 207
204 size_t GetConsecutiveTlpCount() const override; 208 size_t GetConsecutiveTlpCount() const override;
205 209
210 void OnApplicationLimited() override;
211
206 private: 212 private:
207 friend class test::QuicConnectionPeer; 213 friend class test::QuicConnectionPeer;
208 friend class test::QuicSentPacketManagerPeer; 214 friend class test::QuicSentPacketManagerPeer;
209 215
210 // The retransmission timer is a single timer which switches modes depending 216 // The retransmission timer is a single timer which switches modes depending
211 // upon connection state. 217 // upon connection state.
212 enum RetransmissionTimeoutMode { 218 enum RetransmissionTimeoutMode {
213 // A conventional TCP style RTO. 219 // A conventional TCP style RTO.
214 RTO_MODE, 220 RTO_MODE,
215 // A tail loss probe. By default, QUIC sends up to two before RTOing. 221 // A tail loss probe. By default, QUIC sends up to two before RTOing.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 QuicPacketNumber acked_packet_number); 310 QuicPacketNumber acked_packet_number);
305 311
306 // Returns mutable TransmissionInfo associated with |packet_number|, which 312 // Returns mutable TransmissionInfo associated with |packet_number|, which
307 // must be unacked. 313 // must be unacked.
308 TransmissionInfo* GetMutableTransmissionInfo(QuicPacketNumber packet_number); 314 TransmissionInfo* GetMutableTransmissionInfo(QuicPacketNumber packet_number);
309 315
310 // Remove any packets no longer needed for retransmission, congestion, or 316 // Remove any packets no longer needed for retransmission, congestion, or
311 // RTT measurement purposes. 317 // RTT measurement purposes.
312 void RemoveObsoletePackets(); 318 void RemoveObsoletePackets();
313 319
314 // Enables pacing if it has not already been enabled. 320 // Sets the send algorithm to the given congestion control type and points the
315 void EnablePacing(); 321 // pacing sender at |send_algorithm_|. Can be called any number of times.
322 void SetSendAlgorithm(CongestionControlType congestion_control_type);
323
324 // Sets the send algorithm to |send_algorithm| and points the pacing sender at
325 // |send_algorithm_|. Takes ownership of |send_algorithm|. Can be called any
326 // number of times.
327 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm);
316 328
317 // Newly serialized retransmittable packets are added to this map, which 329 // Newly serialized retransmittable packets are added to this map, which
318 // contains owning pointers to any contained frames. If a packet is 330 // contains owning pointers to any contained frames. If a packet is
319 // retransmitted, this map will contain entries for both the old and the new 331 // retransmitted, this map will contain entries for both the old and the new
320 // packet. The old packet's retransmittable frames entry will be nullptr, 332 // packet. The old packet's retransmittable frames entry will be nullptr,
321 // while the new packet's entry will contain the frames to retransmit. 333 // while the new packet's entry will contain the frames to retransmit.
322 // If the old packet is acked before the new packet, then the old entry will 334 // If the old packet is acked before the new packet, then the old entry will
323 // be removed from the map and the new entry's retransmittable frames will be 335 // be removed from the map and the new entry's retransmittable frames will be
324 // set to nullptr. 336 // set to nullptr.
325 QuicUnackedPacketMap unacked_packets_; 337 QuicUnackedPacketMap unacked_packets_;
(...skipping 10 matching lines...) Expand all
336 QuicConnectionStats* stats_; 348 QuicConnectionStats* stats_;
337 349
338 // Pending retransmissions are managed by delegate_ if it is not null. 350 // Pending retransmissions are managed by delegate_ if it is not null.
339 MultipathDelegateInterface* delegate_; // Not owned. 351 MultipathDelegateInterface* delegate_; // Not owned.
340 352
341 DebugDelegate* debug_delegate_; 353 DebugDelegate* debug_delegate_;
342 NetworkChangeVisitor* network_change_visitor_; 354 NetworkChangeVisitor* network_change_visitor_;
343 const QuicPacketCount initial_congestion_window_; 355 const QuicPacketCount initial_congestion_window_;
344 RttStats rtt_stats_; 356 RttStats rtt_stats_;
345 std::unique_ptr<SendAlgorithmInterface> send_algorithm_; 357 std::unique_ptr<SendAlgorithmInterface> send_algorithm_;
346 std::unique_ptr<LossDetectionInterface> loss_algorithm_; 358 // Not owned. Always points to |general_loss_algorithm_| outside of tests.
359 LossDetectionInterface* loss_algorithm_;
360 GeneralLossAlgorithm general_loss_algorithm_;
347 bool n_connection_simulation_; 361 bool n_connection_simulation_;
348 362
349 // Receiver side buffer in bytes. 363 // Receiver side buffer in bytes.
350 QuicByteCount receive_buffer_bytes_; 364 QuicByteCount receive_buffer_bytes_;
351 365
352 // Least packet number which the peer is still waiting for. 366 // Least packet number which the peer is still waiting for.
353 QuicPacketNumber least_packet_awaited_by_peer_; 367 QuicPacketNumber least_packet_awaited_by_peer_;
354 368
355 // Tracks the first RTO packet. If any packet before that packet gets acked, 369 // Tracks the first RTO packet. If any packet before that packet gets acked,
356 // it indicates the RTO was spurious and should be reversed(F-RTO). 370 // it indicates the RTO was spurious and should be reversed(F-RTO).
357 QuicPacketNumber first_rto_transmission_; 371 QuicPacketNumber first_rto_transmission_;
358 // Number of times the RTO timer has fired in a row without receiving an ack. 372 // Number of times the RTO timer has fired in a row without receiving an ack.
359 size_t consecutive_rto_count_; 373 size_t consecutive_rto_count_;
360 // Number of times the tail loss probe has been sent. 374 // Number of times the tail loss probe has been sent.
361 size_t consecutive_tlp_count_; 375 size_t consecutive_tlp_count_;
362 // Number of times the crypto handshake has been retransmitted. 376 // Number of times the crypto handshake has been retransmitted.
363 size_t consecutive_crypto_retransmission_count_; 377 size_t consecutive_crypto_retransmission_count_;
364 // Number of pending transmissions of TLP, RTO, or crypto packets. 378 // Number of pending transmissions of TLP, RTO, or crypto packets.
365 size_t pending_timer_transmission_count_; 379 size_t pending_timer_transmission_count_;
366 // Maximum number of tail loss probes to send before firing an RTO. 380 // Maximum number of tail loss probes to send before firing an RTO.
367 size_t max_tail_loss_probes_; 381 size_t max_tail_loss_probes_;
368 // If true, send the TLP at 0.5 RTT. 382 // If true, send the TLP at 0.5 RTT.
369 bool enable_half_rtt_tail_loss_probe_; 383 bool enable_half_rtt_tail_loss_probe_;
370 bool using_pacing_; 384 bool using_pacing_;
371 // TODO(jdorfman): Remove |using_pacing_| and rename |using_inline_pacing_| to
372 // |using_pacing| when deprecating
373 // gfe2_reloadable_flag_quic_use_inline_pacing.
374 bool using_inline_pacing_;
375 // If true, use the new RTO with loss based CWND reduction instead of the send 385 // If true, use the new RTO with loss based CWND reduction instead of the send
376 // algorithms's OnRetransmissionTimeout to reduce the congestion window. 386 // algorithms's OnRetransmissionTimeout to reduce the congestion window.
377 bool use_new_rto_; 387 bool use_new_rto_;
378 // If true, cancel pending retransmissions if they're larger than 388 // If true, cancel pending retransmissions if they're larger than
379 // largest_newly_acked. 389 // largest_newly_acked.
380 bool undo_pending_retransmits_; 390 bool undo_pending_retransmits_;
381 391
382 // Vectors packets acked and lost as a result of the last congestion event. 392 // Vectors packets acked and lost as a result of the last congestion event.
383 SendAlgorithmInterface::CongestionVector packets_acked_; 393 SendAlgorithmInterface::CongestionVector packets_acked_;
384 SendAlgorithmInterface::CongestionVector packets_lost_; 394 SendAlgorithmInterface::CongestionVector packets_lost_;
385 // Largest newly acknowledged packet. 395 // Largest newly acknowledged packet.
386 QuicPacketNumber largest_newly_acked_; 396 QuicPacketNumber largest_newly_acked_;
387 // Largest packet in bytes ever acknowledged. 397 // Largest packet in bytes ever acknowledged.
388 QuicPacketLength largest_mtu_acked_; 398 QuicPacketLength largest_mtu_acked_;
389 399
400 // Replaces certain calls to |send_algorithm_| when |using_pacing_| is true.
401 // Calls into |send_algorithm_| for the underlying congestion control.
390 PacingSender pacing_sender_; 402 PacingSender pacing_sender_;
391 403
392 // Set to true after the crypto handshake has successfully completed. After 404 // Set to true after the crypto handshake has successfully completed. After
393 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on 405 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on
394 // the crypto stream (i.e. SCUP messages) are treated like normal 406 // the crypto stream (i.e. SCUP messages) are treated like normal
395 // retransmittable frames. 407 // retransmittable frames.
396 bool handshake_confirmed_; 408 bool handshake_confirmed_;
397 409
398 // Records bandwidth from server to client in normal operation, over periods 410 // Records bandwidth from server to client in normal operation, over periods
399 // of time with no loss events. 411 // of time with no loss events.
400 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_; 412 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_;
401 413
402 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); 414 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager);
403 }; 415 };
404 416
405 } // namespace net 417 } // namespace net
406 418
407 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ 419 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_received_packet_manager_test.cc ('k') | net/quic/core/quic_sent_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698