| 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/congestion_control/hybrid_slow_start.h" | 5 #include "net/quic/congestion_control/hybrid_slow_start.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 // Note(pwestin): the magic clamping numbers come from the original code in | 9 // Note(pwestin): the magic clamping numbers come from the original code in |
| 10 // tcp_cubic.c. | 10 // tcp_cubic.c. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 current_rtt_(QuicTime::Delta::Zero()) { | 26 current_rtt_(QuicTime::Delta::Zero()) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 void HybridSlowStart::Restart() { | 29 void HybridSlowStart::Restart() { |
| 30 found_ack_train_ = false; | 30 found_ack_train_ = false; |
| 31 found_delay_ = false; | 31 found_delay_ = false; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void HybridSlowStart::Reset(QuicPacketSequenceNumber end_sequence_number) { | 34 void HybridSlowStart::Reset(QuicPacketSequenceNumber end_sequence_number) { |
| 35 DLOG(INFO) << "Reset hybrid slow start @" << end_sequence_number; | 35 DLOG(INFO) << "Reset hybrid slow start @" << end_sequence_number; |
| 36 round_start_ = last_time_ = clock_->Now(); | 36 round_start_ = last_time_ = clock_->ApproximateNow(); |
| 37 end_sequence_number_ = end_sequence_number; | 37 end_sequence_number_ = end_sequence_number; |
| 38 current_rtt_ = QuicTime::Delta::Zero(); | 38 current_rtt_ = QuicTime::Delta::Zero(); |
| 39 sample_count_ = 0; | 39 sample_count_ = 0; |
| 40 started_ = true; | 40 started_ = true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool HybridSlowStart::EndOfRound(QuicPacketSequenceNumber ack) { | 43 bool HybridSlowStart::EndOfRound(QuicPacketSequenceNumber ack) { |
| 44 // TODO(pwestin): do we need to handle wraparound? | 44 // TODO(pwestin): do we need to handle wraparound? |
| 45 return end_sequence_number_ <= ack; | 45 return end_sequence_number_ <= ack; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void HybridSlowStart::Update(QuicTime::Delta rtt, QuicTime::Delta delay_min) { | 48 void HybridSlowStart::Update(QuicTime::Delta rtt, QuicTime::Delta delay_min) { |
| 49 // The original code doesn't invoke this until we hit 16 packet per burst. | 49 // The original code doesn't invoke this until we hit 16 packet per burst. |
| 50 // Since the code handles lower than 16 grecefully and I removed that | 50 // Since the code handles lower than 16 grecefully and I removed that |
| 51 // limit. | 51 // limit. |
| 52 if (found_ack_train_ || found_delay_) { | 52 if (found_ack_train_ || found_delay_) { |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 QuicTime current_time = clock_->Now(); | 55 QuicTime current_time = clock_->ApproximateNow(); |
| 56 | 56 |
| 57 // First detection parameter - ack-train detection. | 57 // First detection parameter - ack-train detection. |
| 58 // Since slow start burst out packets we can indirectly estimate the inter- | 58 // Since slow start burst out packets we can indirectly estimate the inter- |
| 59 // arrival time by looking at the arrival time of the ACKs if the ACKs are | 59 // arrival time by looking at the arrival time of the ACKs if the ACKs are |
| 60 // spread out more then half the minimum RTT packets are beeing spread out | 60 // spread out more then half the minimum RTT packets are beeing spread out |
| 61 // more than the capacity. | 61 // more than the capacity. |
| 62 // This first trigger will not come into play until we hit roughly 4.8 Mbit/s. | 62 // This first trigger will not come into play until we hit roughly 4.8 Mbit/s. |
| 63 // TODO(pwestin): we need to make sure our pacing don't trigger this detector. | 63 // TODO(pwestin): we need to make sure our pacing don't trigger this detector. |
| 64 if (current_time.Subtract(last_time_).ToMicroseconds() <= | 64 if (current_time.Subtract(last_time_).ToMicroseconds() <= |
| 65 kHybridStartDelayMinThresholdUs) { | 65 kHybridStartDelayMinThresholdUs) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bool HybridSlowStart::Exit() { | 99 bool HybridSlowStart::Exit() { |
| 100 // If either one of the two conditions are met we exit from slow start | 100 // If either one of the two conditions are met we exit from slow start |
| 101 // immediately. | 101 // immediately. |
| 102 if (found_ack_train_ || found_delay_) { | 102 if (found_ack_train_ || found_delay_) { |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace net | 108 } // namespace net |
| OLD | NEW |