| 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/paced_sender.h" | 5 #include "net/quic/congestion_control/paced_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 QuicTime::Delta PacedSender::TimeUntilSend(QuicTime now, | 37 QuicTime::Delta PacedSender::TimeUntilSend(QuicTime now, |
| 38 QuicTime::Delta time_until_send) { | 38 QuicTime::Delta time_until_send) { |
| 39 if (time_until_send.ToMicroseconds() >= kMaxSchedulingDelayUs) { | 39 if (time_until_send.ToMicroseconds() >= kMaxSchedulingDelayUs) { |
| 40 return time_until_send; | 40 return time_until_send; |
| 41 } | 41 } |
| 42 // Pace the data. | 42 // Pace the data. |
| 43 QuicByteCount pacing_window = pace_.ToBytesPerPeriod( | 43 QuicByteCount pacing_window = pace_.ToBytesPerPeriod( |
| 44 QuicTime::Delta::FromMicroseconds(kMaxSchedulingDelayUs)); | 44 QuicTime::Delta::FromMicroseconds(kMaxSchedulingDelayUs)); |
| 45 QuicByteCount min_window_size = kMinPacketBurstSize * max_segment_size_; | 45 QuicByteCount min_window_size = kMinPacketBurstSize * max_segment_size_; |
| 46 pacing_window = max(pacing_window, min_window_size); | 46 pacing_window = max(pacing_window, min_window_size); |
| 47 | 47 |
| 48 if (pacing_window > leaky_bucket_.BytesPending(now)) { | 48 if (pacing_window > leaky_bucket_.BytesPending(now)) { |
| 49 // We have not filled our pacing window yet. | 49 // We have not filled our pacing window yet. |
| 50 return time_until_send; | 50 return time_until_send; |
| 51 } | 51 } |
| 52 return leaky_bucket_.TimeRemaining(now); | 52 return leaky_bucket_.TimeRemaining(now); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace net | 55 } // namespace net |
| OLD | NEW |