| 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 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void PacingSender::OnRetransmissionTimeout(bool packets_retransmitted) { | 110 void PacingSender::OnRetransmissionTimeout(bool packets_retransmitted) { |
| 111 sender_->OnRetransmissionTimeout(packets_retransmitted); | 111 sender_->OnRetransmissionTimeout(packets_retransmitted); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void PacingSender::OnConnectionMigration() { | 114 void PacingSender::OnConnectionMigration() { |
| 115 sender_->OnConnectionMigration(); | 115 sender_->OnConnectionMigration(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 QuicTime::Delta PacingSender::TimeUntilSend( | 118 QuicTime::Delta PacingSender::TimeUntilSend( |
| 119 QuicTime now, | 119 QuicTime now, |
| 120 QuicByteCount bytes_in_flight, | 120 QuicByteCount bytes_in_flight) const { |
| 121 HasRetransmittableData has_retransmittable_data) const { | |
| 122 QuicTime::Delta time_until_send = | 121 QuicTime::Delta time_until_send = |
| 123 sender_->TimeUntilSend(now, bytes_in_flight, has_retransmittable_data); | 122 sender_->TimeUntilSend(now, bytes_in_flight); |
| 124 if (burst_tokens_ > 0 || bytes_in_flight == 0) { | 123 if (burst_tokens_ > 0 || bytes_in_flight == 0) { |
| 125 // Don't pace if we have burst tokens available or leaving quiescence. | 124 // Don't pace if we have burst tokens available or leaving quiescence. |
| 126 return time_until_send; | 125 return time_until_send; |
| 127 } | 126 } |
| 128 | 127 |
| 129 if (!time_until_send.IsZero()) { | 128 if (!time_until_send.IsZero()) { |
| 130 DCHECK(time_until_send.IsInfinite()); | 129 DCHECK(time_until_send.IsInfinite()); |
| 131 // The underlying sender prevents sending. | 130 // The underlying sender prevents sending. |
| 132 return time_until_send; | 131 return time_until_send; |
| 133 } | 132 } |
| 134 | 133 |
| 135 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { | |
| 136 // Don't pace ACK packets, since they do not count against CWND and do not | |
| 137 // cause CWND to grow. | |
| 138 return QuicTime::Delta::Zero(); | |
| 139 } | |
| 140 | |
| 141 // If the next send time is within the alarm granularity, send immediately. | 134 // If the next send time is within the alarm granularity, send immediately. |
| 142 if (ideal_next_packet_send_time_ > now.Add(alarm_granularity_)) { | 135 if (ideal_next_packet_send_time_ > now.Add(alarm_granularity_)) { |
| 143 DVLOG(1) << "Delaying packet: " | 136 DVLOG(1) << "Delaying packet: " |
| 144 << ideal_next_packet_send_time_.Subtract(now).ToMicroseconds(); | 137 << ideal_next_packet_send_time_.Subtract(now).ToMicroseconds(); |
| 145 was_last_send_delayed_ = true; | 138 was_last_send_delayed_ = true; |
| 146 return ideal_next_packet_send_time_.Subtract(now); | 139 return ideal_next_packet_send_time_.Subtract(now); |
| 147 } | 140 } |
| 148 | 141 |
| 149 DVLOG(1) << "Sending packet now"; | 142 DVLOG(1) << "Sending packet now"; |
| 150 return QuicTime::Delta::Zero(); | 143 return QuicTime::Delta::Zero(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 176 | 169 |
| 177 QuicByteCount PacingSender::GetSlowStartThreshold() const { | 170 QuicByteCount PacingSender::GetSlowStartThreshold() const { |
| 178 return sender_->GetSlowStartThreshold(); | 171 return sender_->GetSlowStartThreshold(); |
| 179 } | 172 } |
| 180 | 173 |
| 181 CongestionControlType PacingSender::GetCongestionControlType() const { | 174 CongestionControlType PacingSender::GetCongestionControlType() const { |
| 182 return sender_->GetCongestionControlType(); | 175 return sender_->GetCongestionControlType(); |
| 183 } | 176 } |
| 184 | 177 |
| 185 } // namespace net | 178 } // namespace net |
| OLD | NEW |