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