| OLD | NEW |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // a follow up CL to update the unit test. | 47 // a follow up CL to update the unit test. |
| 48 // Returns true if this ack the last sequence number of our current slow start | 48 // Returns true if this ack the last sequence number of our current slow start |
| 49 // round. | 49 // round. |
| 50 // Call Reset if this returns true. | 50 // Call Reset if this returns true. |
| 51 bool IsEndOfRound(QuicPacketSequenceNumber ack) const; | 51 bool IsEndOfRound(QuicPacketSequenceNumber ack) const; |
| 52 | 52 |
| 53 // Call for the start of each receive round (burst) in the slow start phase. | 53 // Call for the start of each receive round (burst) in the slow start phase. |
| 54 void StartReceiveRound(QuicPacketSequenceNumber last_sent); | 54 void StartReceiveRound(QuicPacketSequenceNumber last_sent); |
| 55 | 55 |
| 56 // Whether slow start has started. | 56 // Whether slow start has started. |
| 57 bool started() const { | 57 bool started() const { return started_; } |
| 58 return started_; | |
| 59 } | |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 // Whether a condition for exiting slow start has been found. | 60 // Whether a condition for exiting slow start has been found. |
| 63 enum HystartState { | 61 enum HystartState { |
| 64 NOT_FOUND, | 62 NOT_FOUND, |
| 65 ACK_TRAIN, // A closely spaced ack train is too long. | 63 ACK_TRAIN, // A closely spaced ack train is too long. |
| 66 DELAY, // Too much increase in the round's min_rtt was observed. | 64 DELAY, // Too much increase in the round's min_rtt was observed. |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 const QuicClock* clock_; | 67 const QuicClock* clock_; |
| 70 // Whether the hybrid slow start has been started. | 68 // Whether the hybrid slow start has been started. |
| 71 bool started_; | 69 bool started_; |
| 72 HystartState hystart_found_; | 70 HystartState hystart_found_; |
| 73 // Last sequence number sent which was CWND limited. | 71 // Last sequence number sent which was CWND limited. |
| 74 QuicPacketSequenceNumber last_sent_sequence_number_; | 72 QuicPacketSequenceNumber last_sent_sequence_number_; |
| 75 | 73 |
| 76 // Variables for tracking acks received during a slow start round. | 74 // Variables for tracking acks received during a slow start round. |
| 77 QuicTime round_start_; // Beginning of each slow start receive round. | 75 QuicTime round_start_; // Beginning of each slow start receive round. |
| 78 QuicPacketSequenceNumber end_sequence_number_; // End of the receive round. | 76 QuicPacketSequenceNumber end_sequence_number_; // End of the receive round. |
| 79 // Last time when the spacing between ack arrivals was less than 2 ms. | 77 // Last time when the spacing between ack arrivals was less than 2 ms. |
| 80 // Defaults to the beginning of the round. | 78 // Defaults to the beginning of the round. |
| 81 QuicTime last_close_ack_pair_time_; | 79 QuicTime last_close_ack_pair_time_; |
| 82 uint32 rtt_sample_count_; // Number of rtt samples in the current round. | 80 uint32 rtt_sample_count_; // Number of rtt samples in the current round. |
| 83 QuicTime::Delta current_min_rtt_; // The minimum rtt of current round. | 81 QuicTime::Delta current_min_rtt_; // The minimum rtt of current round. |
| 84 | 82 |
| 85 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart); | 83 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart); |
| 86 }; | 84 }; |
| 87 | 85 |
| 88 } // namespace net | 86 } // namespace net |
| 89 | 87 |
| 90 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_ | 88 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_ |
| OLD | NEW |