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

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

Issue 497553004: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with TOT Created 6 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
« no previous file with comments | « net/quic/quic_sent_entropy_manager_test.cc ('k') | net/quic/quic_sent_packet_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <queue> 11 #include <queue>
12 #include <set> 12 #include <set>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "net/base/linked_hash_map.h" 18 #include "net/base/linked_hash_map.h"
19 #include "net/quic/congestion_control/loss_detection_interface.h" 19 #include "net/quic/congestion_control/loss_detection_interface.h"
20 #include "net/quic/congestion_control/rtt_stats.h" 20 #include "net/quic/congestion_control/rtt_stats.h"
21 #include "net/quic/congestion_control/send_algorithm_interface.h" 21 #include "net/quic/congestion_control/send_algorithm_interface.h"
22 #include "net/quic/quic_ack_notifier_manager.h" 22 #include "net/quic/quic_ack_notifier_manager.h"
23 #include "net/quic/quic_protocol.h" 23 #include "net/quic/quic_protocol.h"
24 #include "net/quic/quic_sustained_bandwidth_recorder.h"
24 #include "net/quic/quic_unacked_packet_map.h" 25 #include "net/quic/quic_unacked_packet_map.h"
25 26
26 namespace net { 27 namespace net {
27 28
28 namespace test { 29 namespace test {
29 class QuicConnectionPeer; 30 class QuicConnectionPeer;
30 class QuicSentPacketManagerPeer; 31 class QuicSentPacketManagerPeer;
31 } // namespace test 32 } // namespace test
32 33
33 class QuicClock; 34 class QuicClock;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Returns the current delay for the retransmission timer, which may send 191 // Returns the current delay for the retransmission timer, which may send
191 // either a tail loss probe or do a full RTO. Returns QuicTime::Zero() if 192 // either a tail loss probe or do a full RTO. Returns QuicTime::Zero() if
192 // there are no retransmittable packets. 193 // there are no retransmittable packets.
193 const QuicTime GetRetransmissionTime() const; 194 const QuicTime GetRetransmissionTime() const;
194 195
195 const RttStats* GetRttStats() const; 196 const RttStats* GetRttStats() const;
196 197
197 // Returns the estimated bandwidth calculated by the congestion algorithm. 198 // Returns the estimated bandwidth calculated by the congestion algorithm.
198 QuicBandwidth BandwidthEstimate() const; 199 QuicBandwidth BandwidthEstimate() const;
199 200
200 // Returns true if the current bandwidth estimate is reliable. 201 // Returns true if the current instantaneous bandwidth estimate is reliable.
201 bool HasReliableBandwidthEstimate() const; 202 bool HasReliableBandwidthEstimate() const;
202 203
204 const QuicSustainedBandwidthRecorder& SustainedBandwidthRecorder() const;
205
203 // Returns the size of the current congestion window in bytes. Note, this is 206 // Returns the size of the current congestion window in bytes. Note, this is
204 // not the *available* window. Some send algorithms may not use a congestion 207 // not the *available* window. Some send algorithms may not use a congestion
205 // window and will return 0. 208 // window and will return 0.
206 QuicByteCount GetCongestionWindow() const; 209 QuicByteCount GetCongestionWindow() const;
207 210
208 // Returns the size of the slow start congestion window in bytes, 211 // Returns the size of the slow start congestion window in bytes,
209 // aka ssthresh. Some send algorithms do not define a slow start 212 // aka ssthresh. Some send algorithms do not define a slow start
210 // threshold and will return 0. 213 // threshold and will return 0.
211 QuicByteCount GetSlowStartThreshold() const; 214 QuicByteCount GetSlowStartThreshold() const;
212 215
213 // Enables pacing if it has not already been enabled. 216 // Enables pacing if it has not already been enabled.
214 void EnablePacing(); 217 void EnablePacing();
215 218
216 bool using_pacing() const { return using_pacing_; } 219 bool using_pacing() const { return using_pacing_; }
217 220
218 void set_debug_delegate(DebugDelegate* debug_delegate) { 221 void set_debug_delegate(DebugDelegate* debug_delegate) {
219 debug_delegate_ = debug_delegate; 222 debug_delegate_ = debug_delegate;
220 } 223 }
221 224
222 QuicPacketSequenceNumber largest_observed() const { 225 QuicPacketSequenceNumber largest_observed() const {
223 return largest_observed_; 226 return unacked_packets_.largest_observed();
227 }
228
229 QuicPacketSequenceNumber least_packet_awaited_by_peer() {
230 return least_packet_awaited_by_peer_;
224 } 231 }
225 232
226 void set_network_change_visitor(NetworkChangeVisitor* visitor) { 233 void set_network_change_visitor(NetworkChangeVisitor* visitor) {
227 DCHECK(!network_change_visitor_); 234 DCHECK(!network_change_visitor_);
228 DCHECK(visitor); 235 DCHECK(visitor);
229 network_change_visitor_ = visitor; 236 network_change_visitor_ = visitor;
230 } 237 }
231 238
232 size_t consecutive_rto_count() const { 239 size_t consecutive_rto_count() const {
233 return consecutive_rto_count_; 240 return consecutive_rto_count_;
(...skipping 17 matching lines...) Expand all
251 // Retransmission of handshake packets prior to handshake completion. 258 // Retransmission of handshake packets prior to handshake completion.
252 HANDSHAKE_MODE, 259 HANDSHAKE_MODE,
253 // Re-invoke the loss detection when a packet is not acked before the 260 // Re-invoke the loss detection when a packet is not acked before the
254 // loss detection algorithm expects. 261 // loss detection algorithm expects.
255 LOSS_MODE, 262 LOSS_MODE,
256 }; 263 };
257 264
258 typedef linked_hash_map<QuicPacketSequenceNumber, 265 typedef linked_hash_map<QuicPacketSequenceNumber,
259 TransmissionType> PendingRetransmissionMap; 266 TransmissionType> PendingRetransmissionMap;
260 267
268 // Updates the least_packet_awaited_by_peer.
269 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& ack_frame);
270
261 // Process the incoming ack looking for newly ack'd data packets. 271 // Process the incoming ack looking for newly ack'd data packets.
262 void HandleAckForSentPackets(const QuicAckFrame& ack_frame); 272 void HandleAckForSentPackets(const QuicAckFrame& ack_frame);
263 273
264 // Returns the current retransmission mode. 274 // Returns the current retransmission mode.
265 RetransmissionTimeoutMode GetRetransmissionMode() const; 275 RetransmissionTimeoutMode GetRetransmissionMode() const;
266 276
267 // Retransmits all crypto stream packets. 277 // Retransmits all crypto stream packets.
268 void RetransmitCryptoPackets(); 278 void RetransmitCryptoPackets();
269 279
270 // Retransmits all the packets and abandons by invoking a full RTO. 280 // Retransmits all the packets and abandons by invoking a full RTO.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 AckNotifierManager ack_notifier_manager_; 351 AckNotifierManager ack_notifier_manager_;
342 352
343 const QuicClock* clock_; 353 const QuicClock* clock_;
344 QuicConnectionStats* stats_; 354 QuicConnectionStats* stats_;
345 DebugDelegate* debug_delegate_; 355 DebugDelegate* debug_delegate_;
346 NetworkChangeVisitor* network_change_visitor_; 356 NetworkChangeVisitor* network_change_visitor_;
347 RttStats rtt_stats_; 357 RttStats rtt_stats_;
348 scoped_ptr<SendAlgorithmInterface> send_algorithm_; 358 scoped_ptr<SendAlgorithmInterface> send_algorithm_;
349 scoped_ptr<LossDetectionInterface> loss_algorithm_; 359 scoped_ptr<LossDetectionInterface> loss_algorithm_;
350 360
351 // The largest sequence number which we have sent and received an ACK for 361 // Least sequence number which the peer is still waiting for.
352 // from the peer. 362 QuicPacketSequenceNumber least_packet_awaited_by_peer_;
353 QuicPacketSequenceNumber largest_observed_;
354 363
355 // Tracks the first RTO packet. If any packet before that packet gets acked, 364 // 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). 365 // it indicates the RTO was spurious and should be reversed(F-RTO).
357 QuicPacketSequenceNumber first_rto_transmission_; 366 QuicPacketSequenceNumber first_rto_transmission_;
358 // Number of times the RTO timer has fired in a row without receiving an ack. 367 // Number of times the RTO timer has fired in a row without receiving an ack.
359 size_t consecutive_rto_count_; 368 size_t consecutive_rto_count_;
360 // Number of times the tail loss probe has been sent. 369 // Number of times the tail loss probe has been sent.
361 size_t consecutive_tlp_count_; 370 size_t consecutive_tlp_count_;
362 // Number of times the crypto handshake has been retransmitted. 371 // Number of times the crypto handshake has been retransmitted.
363 size_t consecutive_crypto_retransmission_count_; 372 size_t consecutive_crypto_retransmission_count_;
364 // Number of pending transmissions of TLP or crypto packets. 373 // Number of pending transmissions of TLP or crypto packets.
365 size_t pending_timer_transmission_count_; 374 size_t pending_timer_transmission_count_;
366 // Maximum number of tail loss probes to send before firing an RTO. 375 // Maximum number of tail loss probes to send before firing an RTO.
367 size_t max_tail_loss_probes_; 376 size_t max_tail_loss_probes_;
368 bool using_pacing_; 377 bool using_pacing_;
369 378
370 // Sets of packets acked and lost as a result of the last congestion event. 379 // Sets of packets acked and lost as a result of the last congestion event.
371 SendAlgorithmInterface::CongestionMap packets_acked_; 380 SendAlgorithmInterface::CongestionMap packets_acked_;
372 SendAlgorithmInterface::CongestionMap packets_lost_; 381 SendAlgorithmInterface::CongestionMap packets_lost_;
373 382
374 // Set to true after the crypto handshake has successfully completed. After 383 // Set to true after the crypto handshake has successfully completed. After
375 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on 384 // this is true we no longer use HANDSHAKE_MODE, and further frames sent on
376 // the crypto stream (i.e. SCUP messages) are treated like normal 385 // the crypto stream (i.e. SCUP messages) are treated like normal
377 // retransmittable frames. 386 // retransmittable frames.
378 bool handshake_confirmed_; 387 bool handshake_confirmed_;
379 388
389 // Records bandwidth from server to client in normal operation, over periods
390 // of time with no loss events.
391 QuicSustainedBandwidthRecorder sustained_bandwidth_recorder_;
392
380 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); 393 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager);
381 }; 394 };
382 395
383 } // namespace net 396 } // namespace net
384 397
385 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ 398 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_sent_entropy_manager_test.cc ('k') | net/quic/quic_sent_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698