| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // TODO(ianswett): The following methods should be private, but that requires | 46 // TODO(ianswett): The following methods should be private, but that requires |
| 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 void set_ack_train_detection(bool ack_train_detection) { |
| 57 ack_train_detection_ = ack_train_detection; |
| 58 } |
| 59 |
| 60 bool ack_train_detection() const { |
| 61 return ack_train_detection_; |
| 62 } |
| 63 |
| 56 // Whether slow start has started. | 64 // Whether slow start has started. |
| 57 bool started() const { | 65 bool started() const { |
| 58 return started_; | 66 return started_; |
| 59 } | 67 } |
| 60 | 68 |
| 61 private: | 69 private: |
| 62 // Whether a condition for exiting slow start has been found. | 70 // Whether a condition for exiting slow start has been found. |
| 63 enum HystartState { | 71 enum HystartState { |
| 64 NOT_FOUND, | 72 NOT_FOUND, |
| 65 ACK_TRAIN, // A closely spaced ack train is too long. | 73 ACK_TRAIN, // A closely spaced ack train is too long. |
| 66 DELAY, // Too much increase in the round's min_rtt was observed. | 74 DELAY, // Too much increase in the round's min_rtt was observed. |
| 67 }; | 75 }; |
| 68 | 76 |
| 69 const QuicClock* clock_; | 77 const QuicClock* clock_; |
| 78 bool ack_train_detection_; |
| 70 // Whether the hybrid slow start has been started. | 79 // Whether the hybrid slow start has been started. |
| 71 bool started_; | 80 bool started_; |
| 72 HystartState hystart_found_; | 81 HystartState hystart_found_; |
| 73 // Last sequence number sent which was CWND limited. | 82 // Last sequence number sent which was CWND limited. |
| 74 QuicPacketSequenceNumber last_sent_sequence_number_; | 83 QuicPacketSequenceNumber last_sent_sequence_number_; |
| 75 | 84 |
| 76 // Variables for tracking acks received during a slow start round. | 85 // Variables for tracking acks received during a slow start round. |
| 77 QuicTime round_start_; // Beginning of each slow start receive round. | 86 QuicTime round_start_; // Beginning of each slow start receive round. |
| 78 QuicPacketSequenceNumber end_sequence_number_; // End of the receive round. | 87 QuicPacketSequenceNumber end_sequence_number_; // End of the receive round. |
| 79 // Last time when the spacing between ack arrivals was less than 2 ms. | 88 // Last time when the spacing between ack arrivals was less than 2 ms. |
| 80 // Defaults to the beginning of the round. | 89 // Defaults to the beginning of the round. |
| 81 QuicTime last_close_ack_pair_time_; | 90 QuicTime last_close_ack_pair_time_; |
| 82 uint32 rtt_sample_count_; // Number of rtt samples in the current round. | 91 uint32 rtt_sample_count_; // Number of rtt samples in the current round. |
| 83 QuicTime::Delta current_min_rtt_; // The minimum rtt of current round. | 92 QuicTime::Delta current_min_rtt_; // The minimum rtt of current round. |
| 84 | 93 |
| 85 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart); | 94 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart); |
| 86 }; | 95 }; |
| 87 | 96 |
| 88 } // namespace net | 97 } // namespace net |
| 89 | 98 |
| 90 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_ | 99 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_ |
| OLD | NEW |