| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 QuicByteCount bytes_in_flight, | 55 QuicByteCount bytes_in_flight, |
| 56 QuicPacketNumber packet_number, | 56 QuicPacketNumber packet_number, |
| 57 QuicByteCount bytes, | 57 QuicByteCount bytes, |
| 58 HasRetransmittableData has_retransmittable_data) { | 58 HasRetransmittableData has_retransmittable_data) { |
| 59 const bool in_flight = | 59 const bool in_flight = |
| 60 sender_->OnPacketSent(sent_time, bytes_in_flight, packet_number, bytes, | 60 sender_->OnPacketSent(sent_time, bytes_in_flight, packet_number, bytes, |
| 61 has_retransmittable_data); | 61 has_retransmittable_data); |
| 62 if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) { | 62 if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) { |
| 63 return in_flight; | 63 return in_flight; |
| 64 } | 64 } |
| 65 if (bytes_in_flight == 0) { | 65 // If in recovery, the connection is not coming out of quiescence. |
| 66 if (bytes_in_flight == 0 && !sender_->InRecovery()) { |
| 66 // Add more burst tokens anytime the connection is leaving quiescence, but | 67 // 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 | 68 // limit it to the equivalent of a single bulk write, not exceeding the |
| 68 // current CWND in packets. | 69 // current CWND in packets. |
| 69 burst_tokens_ = min( | 70 burst_tokens_ = min( |
| 70 initial_packet_burst_, | 71 initial_packet_burst_, |
| 71 static_cast<uint32>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); | 72 static_cast<uint32>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); |
| 72 } | 73 } |
| 73 if (burst_tokens_ > 0) { | 74 if (burst_tokens_ > 0) { |
| 74 --burst_tokens_; | 75 --burst_tokens_; |
| 75 was_last_send_delayed_ = false; | 76 was_last_send_delayed_ = false; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 QuicByteCount PacingSender::GetSlowStartThreshold() const { | 174 QuicByteCount PacingSender::GetSlowStartThreshold() const { |
| 174 return sender_->GetSlowStartThreshold(); | 175 return sender_->GetSlowStartThreshold(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 CongestionControlType PacingSender::GetCongestionControlType() const { | 178 CongestionControlType PacingSender::GetCongestionControlType() const { |
| 178 return sender_->GetCongestionControlType(); | 179 return sender_->GetCongestionControlType(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace net | 182 } // namespace net |
| OLD | NEW |