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 23 matching lines...) Expand all Loading... |
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_->ApproximateNow(); | 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? | |
45 return end_sequence_number_ <= ack; | 44 return end_sequence_number_ <= ack; |
46 } | 45 } |
47 | 46 |
48 void HybridSlowStart::Update(QuicTime::Delta rtt, QuicTime::Delta delay_min) { | 47 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. | 48 // 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 | 49 // Since the code handles lower than 16 grecefully and I removed that |
51 // limit. | 50 // limit. |
52 if (found_ack_train_ || found_delay_) { | 51 if (found_ack_train_ || found_delay_) { |
53 return; | 52 return; |
54 } | 53 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 103 } |
105 return false; | 104 return false; |
106 } | 105 } |
107 | 106 |
108 QuicTime::Delta HybridSlowStart::SmoothedRtt() { | 107 QuicTime::Delta HybridSlowStart::SmoothedRtt() { |
109 // TODO(satyamshekhar): Calculate and return smooth average of rtt over time. | 108 // TODO(satyamshekhar): Calculate and return smooth average of rtt over time. |
110 return current_rtt_; | 109 return current_rtt_; |
111 } | 110 } |
112 | 111 |
113 } // namespace net | 112 } // namespace net |
OLD | NEW |