| 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/fix_rate_sender.h" | 5 #include "net/quic/congestion_control/fix_rate_sender.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (rtt.IsInfinite()) { | 53 if (rtt.IsInfinite()) { |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 latest_rtt_ = rtt; | 56 latest_rtt_ = rtt; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void FixRateSender::OnIncomingLoss(QuicTime /*ack_receive_time*/) { | 59 void FixRateSender::OnIncomingLoss(QuicTime /*ack_receive_time*/) { |
| 60 // Ignore losses for fix rate sender. | 60 // Ignore losses for fix rate sender. |
| 61 } | 61 } |
| 62 | 62 |
| 63 void FixRateSender::SentPacket(QuicTime sent_time, | 63 bool FixRateSender::SentPacket( |
| 64 QuicPacketSequenceNumber /*sequence_number*/, | 64 QuicTime sent_time, |
| 65 QuicByteCount bytes, | 65 QuicPacketSequenceNumber /*sequence_number*/, |
| 66 Retransmission is_retransmission) { | 66 QuicByteCount bytes, |
| 67 Retransmission is_retransmission, |
| 68 HasRetransmittableData /*has_retransmittable_data*/) { |
| 67 fix_rate_leaky_bucket_.Add(sent_time, bytes); | 69 fix_rate_leaky_bucket_.Add(sent_time, bytes); |
| 68 paced_sender_.SentPacket(sent_time, bytes); | 70 paced_sender_.SentPacket(sent_time, bytes); |
| 69 if (is_retransmission == NOT_RETRANSMISSION) { | 71 if (is_retransmission == NOT_RETRANSMISSION) { |
| 70 data_in_flight_ += bytes; | 72 data_in_flight_ += bytes; |
| 71 } | 73 } |
| 74 return true; |
| 72 } | 75 } |
| 73 | 76 |
| 74 void FixRateSender::AbandoningPacket( | 77 void FixRateSender::AbandoningPacket( |
| 75 QuicPacketSequenceNumber /*sequence_number*/, | 78 QuicPacketSequenceNumber /*sequence_number*/, |
| 76 QuicByteCount /*abandoned_bytes*/) { | 79 QuicByteCount /*abandoned_bytes*/) { |
| 77 } | 80 } |
| 78 | 81 |
| 79 QuicTime::Delta FixRateSender::TimeUntilSend( | 82 QuicTime::Delta FixRateSender::TimeUntilSend( |
| 80 QuicTime now, | 83 QuicTime now, |
| 81 Retransmission /*is_retransmission*/, | 84 Retransmission /*is_retransmission*/, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 112 return latest_rtt_; | 115 return latest_rtt_; |
| 113 } | 116 } |
| 114 | 117 |
| 115 QuicTime::Delta FixRateSender::RetransmissionDelay() { | 118 QuicTime::Delta FixRateSender::RetransmissionDelay() { |
| 116 // TODO(pwestin): Calculate and return retransmission delay. | 119 // TODO(pwestin): Calculate and return retransmission delay. |
| 117 // Use 2 * the latest RTT for now. | 120 // Use 2 * the latest RTT for now. |
| 118 return latest_rtt_.Add(latest_rtt_); | 121 return latest_rtt_.Add(latest_rtt_); |
| 119 } | 122 } |
| 120 | 123 |
| 121 } // namespace net | 124 } // namespace net |
| OLD | NEW |