OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pacing_sender.h" | 5 #include "net/quic/congestion_control/pacing_sender.h" |
6 | 6 |
7 using std::min; | 7 using std::min; |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 PacingSender::PacingSender(SendAlgorithmInterface* sender, | 11 PacingSender::PacingSender(SendAlgorithmInterface* sender, |
12 QuicTime::Delta alarm_granularity, | 12 QuicTime::Delta alarm_granularity, |
13 uint32 initial_packet_burst) | 13 uint32_t initial_packet_burst) |
14 : sender_(sender), | 14 : sender_(sender), |
15 alarm_granularity_(alarm_granularity), | 15 alarm_granularity_(alarm_granularity), |
16 initial_packet_burst_(initial_packet_burst), | 16 initial_packet_burst_(initial_packet_burst), |
17 burst_tokens_(initial_packet_burst), | 17 burst_tokens_(initial_packet_burst), |
18 last_delayed_packet_sent_time_(QuicTime::Zero()), | 18 last_delayed_packet_sent_time_(QuicTime::Zero()), |
19 ideal_next_packet_send_time_(QuicTime::Zero()), | 19 ideal_next_packet_send_time_(QuicTime::Zero()), |
20 was_last_send_delayed_(false) {} | 20 was_last_send_delayed_(false) {} |
21 | 21 |
22 PacingSender::~PacingSender() {} | 22 PacingSender::~PacingSender() {} |
23 | 23 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) { | 61 if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) { |
62 return in_flight; | 62 return in_flight; |
63 } | 63 } |
64 // If in recovery, the connection is not coming out of quiescence. | 64 // If in recovery, the connection is not coming out of quiescence. |
65 if (bytes_in_flight == 0 && !sender_->InRecovery()) { | 65 if (bytes_in_flight == 0 && !sender_->InRecovery()) { |
66 // Add more burst tokens anytime the connection is leaving quiescence, but | 66 // Add more burst tokens anytime the connection is leaving quiescence, but |
67 // limit it to the equivalent of a single bulk write, not exceeding the | 67 // limit it to the equivalent of a single bulk write, not exceeding the |
68 // current CWND in packets. | 68 // current CWND in packets. |
69 burst_tokens_ = min( | 69 burst_tokens_ = min( |
70 initial_packet_burst_, | 70 initial_packet_burst_, |
71 static_cast<uint32>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); | 71 static_cast<uint32_t>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); |
72 } | 72 } |
73 if (burst_tokens_ > 0) { | 73 if (burst_tokens_ > 0) { |
74 --burst_tokens_; | 74 --burst_tokens_; |
75 was_last_send_delayed_ = false; | 75 was_last_send_delayed_ = false; |
76 last_delayed_packet_sent_time_ = QuicTime::Zero(); | 76 last_delayed_packet_sent_time_ = QuicTime::Zero(); |
77 ideal_next_packet_send_time_ = QuicTime::Zero(); | 77 ideal_next_packet_send_time_ = QuicTime::Zero(); |
78 return in_flight; | 78 return in_flight; |
79 } | 79 } |
80 // The next packet should be sent as soon as the current packets has been | 80 // The next packet should be sent as soon as the current packets has been |
81 // transferred. | 81 // transferred. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 QuicByteCount PacingSender::GetSlowStartThreshold() const { | 173 QuicByteCount PacingSender::GetSlowStartThreshold() const { |
174 return sender_->GetSlowStartThreshold(); | 174 return sender_->GetSlowStartThreshold(); |
175 } | 175 } |
176 | 176 |
177 CongestionControlType PacingSender::GetCongestionControlType() const { | 177 CongestionControlType PacingSender::GetCongestionControlType() const { |
178 return sender_->GetCongestionControlType(); | 178 return sender_->GetCongestionControlType(); |
179 } | 179 } |
180 | 180 |
181 } // namespace net | 181 } // namespace net |
OLD | NEW |