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

Side by Side Diff: net/quic/congestion_control/hybrid_slow_start.h

Issue 242593002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Use uint32 instead of int Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/net.gypi ('k') | net/quic/congestion_control/hybrid_slow_start.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This class is a helper class to TcpCubicSender. 5 // This class is a helper class to TcpCubicSender.
6 // Slow start is the initial startup phase of TCP, it lasts until first packet 6 // Slow start is the initial startup phase of TCP, it lasts until first packet
7 // loss. This class implements hybrid slow start of the TCP cubic send side 7 // loss. This class implements hybrid slow start of the TCP cubic send side
8 // congestion algorithm. The key feaure of hybrid slow start is that it tries to 8 // congestion algorithm. The key feaure of hybrid slow start is that it tries to
9 // avoid running into the wall too hard during the slow start phase, which 9 // avoid running into the wall too hard during the slow start phase, which
10 // the traditional TCP implementation does. 10 // the traditional TCP implementation does.
(...skipping 19 matching lines...) Expand all
30 30
31 void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, 31 void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
32 bool in_slow_start); 32 bool in_slow_start);
33 33
34 void OnPacketSent(QuicPacketSequenceNumber sequence_number, 34 void OnPacketSent(QuicPacketSequenceNumber sequence_number,
35 QuicByteCount available_send_window); 35 QuicByteCount available_send_window);
36 36
37 bool ShouldExitSlowStart(const RttStats* rtt_stats, 37 bool ShouldExitSlowStart(const RttStats* rtt_stats,
38 int64 congestion_window); 38 int64 congestion_window);
39 39
40 // TODO(ianswett): The following methods should be private, but that requires
41 // a follow up CL to update the unit test.
42 // Start a new slow start phase. 40 // Start a new slow start phase.
43 void Restart(); 41 void Restart();
44 42
43 // TODO(ianswett): The following methods should be private, but that requires
44 // a follow up CL to update the unit test.
45 // Returns true if this ack the last sequence number of our current slow start 45 // Returns true if this ack the last sequence number of our current slow start
46 // round. 46 // round.
47 // Call Reset if this returns true. 47 // Call Reset if this returns true.
48 bool IsEndOfRound(QuicPacketSequenceNumber ack) const; 48 bool IsEndOfRound(QuicPacketSequenceNumber ack) const;
49 49
50 // Call for each round (burst) in the slow start phase. 50 // Call for each round (burst) in the slow start phase.
51 void Reset(QuicPacketSequenceNumber end_sequence_number); 51 void Reset(QuicPacketSequenceNumber end_sequence_number);
52 52
53 // rtt: it the RTT for this ack packet. 53 // rtt: it the RTT for this ack packet.
54 // delay_min: is the lowest delay (RTT) we have seen during the session. 54 // min_rtt: is the lowest delay (RTT) we have seen during the session.
55 void Update(QuicTime::Delta rtt, QuicTime::Delta delay_min); 55 // Returns true if slow start should be exited early, false otherwise.
56 bool UpdateAndMaybeExit(QuicTime::Delta rtt, QuicTime::Delta min_rtt);
56 57
57 // Returns true when we should exit slow start. 58 // Whether slow start has started.
58 bool Exit(); 59 bool started() const {
59 60 return started_;
60 bool started() const { return started_; } 61 }
61 62
62 private: 63 private:
63 const QuicClock* clock_; 64 const QuicClock* clock_;
65 // Whether the hybrid slow start has been started.
64 bool started_; 66 bool started_;
65 bool found_ack_train_; 67 bool found_ack_train_;
66 bool found_delay_; 68 bool found_delay_;
67 QuicTime round_start_; // Beginning of each slow start round. 69 QuicTime round_start_; // Beginning of each slow start round.
68 // We need to keep track of the end sequence number of each RTT "burst". 70 // We need to keep track of the end sequence number of each RTT "burst".
69 bool update_end_sequence_number_; 71 bool update_end_sequence_number_;
72 // TODO(ianswett): This should be redundant to the above, but was moved
73 // from TcpCubicSender to ensure the unit tests continued to pass.
70 QuicPacketSequenceNumber sender_end_sequence_number_; 74 QuicPacketSequenceNumber sender_end_sequence_number_;
71 QuicPacketSequenceNumber end_sequence_number_; // End of slow start round. 75 QuicPacketSequenceNumber end_sequence_number_; // End of slow start round.
72 QuicTime last_time_; // Last time when the ACK spacing was close. 76 // Last time when the spacing between ack arrivals was less than 2 ms.
73 uint8 sample_count_; // Number of samples to decide current RTT. 77 // Defaults to the beginning of the round.
74 QuicTime::Delta current_rtt_; // The minimum rtt of current round. 78 QuicTime last_close_ack_pair_time_;
79 uint32 rtt_sample_count_; // Number of rtt samples in the current round.
80 QuicTime::Delta current_min_rtt_; // The minimum rtt of current round.
75 81
76 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart); 82 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart);
77 }; 83 };
78 84
79 } // namespace net 85 } // namespace net
80 86
81 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_ 87 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/congestion_control/hybrid_slow_start.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698