blob: 21909129daef3b65b1348c82349f5460902bf845 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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
3// found in the LICENSE file.
4
5// Implements Proportional Rate Reduction (PRR) per RFC 6937.
6
7#ifndef QUICHE_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_
8#define QUICHE_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_
9
10#include "net/third_party/quiche/src/quic/core/quic_bandwidth.h"
11#include "net/third_party/quiche/src/quic/core/quic_time.h"
12#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
13
14namespace quic {
15
16class QUIC_EXPORT_PRIVATE PrrSender {
17 public:
18 PrrSender();
19 // OnPacketLost should be called on the first loss that triggers a recovery
20 // period and all other methods in this class should only be called when in
21 // recovery.
22 void OnPacketLost(QuicByteCount prior_in_flight);
23 void OnPacketSent(QuicByteCount sent_bytes);
24 void OnPacketAcked(QuicByteCount acked_bytes);
25 bool CanSend(QuicByteCount congestion_window,
26 QuicByteCount bytes_in_flight,
27 QuicByteCount slowstart_threshold) const;
28
29 private:
30 // Bytes sent and acked since the last loss event.
31 // |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_".
33 QuicByteCount bytes_sent_since_loss_;
34 QuicByteCount bytes_delivered_since_loss_;
35 size_t ack_count_since_loss_;
36
37 // The congestion window before the last loss event.
38 QuicByteCount bytes_in_flight_before_loss_;
39};
40
41} // namespace quic
42
43#endif // QUICHE_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_