| 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 #include "net/quic/core/congestion_control/hybrid_slow_start.h" | 5 #include "net/quic/core/congestion_control/hybrid_slow_start.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "net/quic/platform/api/quic_logging.h" | |
| 10 | |
| 11 namespace net { | 9 namespace net { |
| 12 | 10 |
| 13 // Note(pwestin): the magic clamping numbers come from the original code in | 11 // Note(pwestin): the magic clamping numbers come from the original code in |
| 14 // tcp_cubic.c. | 12 // tcp_cubic.c. |
| 15 const int64_t kHybridStartLowWindow = 16; | 13 const int64_t kHybridStartLowWindow = 16; |
| 16 // Number of delay samples for detecting the increase of delay. | 14 // Number of delay samples for detecting the increase of delay. |
| 17 const uint32_t kHybridStartMinSamples = 8; | 15 const uint32_t kHybridStartMinSamples = 8; |
| 18 // Exit slow start if the min rtt has increased by more than 1/8th. | 16 // Exit slow start if the min rtt has increased by more than 1/8th. |
| 19 const int kHybridStartDelayFactorExp = 3; // 2^3 = 8 | 17 const int kHybridStartDelayFactorExp = 3; // 2^3 = 8 |
| 20 // The original paper specifies 2 and 8ms, but those have changed over time. | 18 // The original paper specifies 2 and 8ms, but those have changed over time. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 void HybridSlowStart::OnPacketSent(QuicPacketNumber packet_number) { | 39 void HybridSlowStart::OnPacketSent(QuicPacketNumber packet_number) { |
| 42 last_sent_packet_number_ = packet_number; | 40 last_sent_packet_number_ = packet_number; |
| 43 } | 41 } |
| 44 | 42 |
| 45 void HybridSlowStart::Restart() { | 43 void HybridSlowStart::Restart() { |
| 46 started_ = false; | 44 started_ = false; |
| 47 hystart_found_ = NOT_FOUND; | 45 hystart_found_ = NOT_FOUND; |
| 48 } | 46 } |
| 49 | 47 |
| 50 void HybridSlowStart::StartReceiveRound(QuicPacketNumber last_sent) { | 48 void HybridSlowStart::StartReceiveRound(QuicPacketNumber last_sent) { |
| 51 QUIC_DVLOG(1) << "Reset hybrid slow start @" << last_sent; | 49 DVLOG(1) << "Reset hybrid slow start @" << last_sent; |
| 52 end_packet_number_ = last_sent; | 50 end_packet_number_ = last_sent; |
| 53 current_min_rtt_ = QuicTime::Delta::Zero(); | 51 current_min_rtt_ = QuicTime::Delta::Zero(); |
| 54 rtt_sample_count_ = 0; | 52 rtt_sample_count_ = 0; |
| 55 started_ = true; | 53 started_ = true; |
| 56 } | 54 } |
| 57 | 55 |
| 58 bool HybridSlowStart::IsEndOfRound(QuicPacketNumber ack) const { | 56 bool HybridSlowStart::IsEndOfRound(QuicPacketNumber ack) const { |
| 59 return end_packet_number_ <= ack; | 57 return end_packet_number_ <= ack; |
| 60 } | 58 } |
| 61 | 59 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 hystart_found_ = DELAY; | 95 hystart_found_ = DELAY; |
| 98 } | 96 } |
| 99 } | 97 } |
| 100 // Exit from slow start if the cwnd is greater than 16 and | 98 // Exit from slow start if the cwnd is greater than 16 and |
| 101 // increasing delay is found. | 99 // increasing delay is found. |
| 102 return congestion_window >= kHybridStartLowWindow && | 100 return congestion_window >= kHybridStartLowWindow && |
| 103 hystart_found_ != NOT_FOUND; | 101 hystart_found_ != NOT_FOUND; |
| 104 } | 102 } |
| 105 | 103 |
| 106 } // namespace net | 104 } // namespace net |
| OLD | NEW |