OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 // Implements Proportional Rate Reduction (PRR) per RFC 6937. | 5 // Implements Proportional Rate Reduction (PRR) per RFC 6937. |
6 | 6 |
7 #ifndef NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ |
8 #define NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ |
9 | 9 |
10 #include "net/quic/quic_bandwidth.h" | 10 #include "net/quic/quic_bandwidth.h" |
11 #include "net/quic/quic_time.h" | 11 #include "net/quic/quic_time.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 class NET_EXPORT_PRIVATE PrrSender { | 15 class NET_EXPORT_PRIVATE PrrSender { |
16 public: | 16 public: |
17 PrrSender(); | 17 PrrSender(); |
18 // OnPacketLost should be called on the first loss that triggers a recovery | 18 // OnPacketLost should be called on the first loss that triggers a recovery |
19 // period and all other methods in this class should only be called when in | 19 // period and all other methods in this class should only be called when in |
20 // recovery. | 20 // recovery. |
21 void OnPacketLost(QuicByteCount bytes_in_flight); | 21 void OnPacketLost(QuicByteCount bytes_in_flight); |
22 void OnPacketSent(QuicByteCount sent_bytes); | 22 void OnPacketSent(QuicByteCount sent_bytes); |
23 void OnPacketAcked(QuicByteCount acked_bytes); | 23 void OnPacketAcked(QuicByteCount acked_bytes); |
24 QuicTime::Delta TimeUntilSend(QuicByteCount congestion_window, | 24 QuicTime::Delta TimeUntilSend(QuicByteCount congestion_window, |
25 QuicByteCount bytes_in_flight, | 25 QuicByteCount bytes_in_flight, |
26 QuicPacketCount slowstart_threshold) | 26 QuicByteCount slowstart_threshold) const; |
27 const; | |
28 | 27 |
29 private: | 28 private: |
30 // Bytes sent and acked since the last loss event. | 29 // Bytes sent and acked since the last loss event. |
31 // |bytes_sent_since_loss_| is the same as "prr_out_" in RFC 6937, | 30 // |bytes_sent_since_loss_| is the same as "prr_out_" in RFC 6937, |
32 // and |bytes_delivered_since_loss_| is the same as "prr_delivered_". | 31 // and |bytes_delivered_since_loss_| is the same as "prr_delivered_". |
33 QuicByteCount bytes_sent_since_loss_; | 32 QuicByteCount bytes_sent_since_loss_; |
34 QuicByteCount bytes_delivered_since_loss_; | 33 QuicByteCount bytes_delivered_since_loss_; |
35 size_t ack_count_since_loss_; | 34 size_t ack_count_since_loss_; |
36 | 35 |
37 // The congestion window before the last loss event. | 36 // The congestion window before the last loss event. |
38 QuicByteCount bytes_in_flight_before_loss_; | 37 QuicByteCount bytes_in_flight_before_loss_; |
39 }; | 38 }; |
40 | 39 |
41 } // namespace net | 40 } // namespace net |
42 | 41 |
43 #endif // NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ | 42 #endif // NET_QUIC_CONGESTION_CONTROL_PRR_SENDER_H_ |
OLD | NEW |