-
Notifications
You must be signed in to change notification settings - Fork 1
/
bbr_algorithm.h
74 lines (54 loc) · 1.59 KB
/
bbr_algorithm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef BBR_BBR_ALGORITHM_H_
#define BBR_BBR_ALGORITHM_H_
#include <cstddef>
#include <cstdint>
#include <bbr_model.h>
#include <common/rate.h>
#include <common/random.h>
#include <bbr_mode.h>
#include <bbr_startup.h>
#include <bbr_drain.h>
#include <bbr_probe_bw.h>
#include <bbr_probe_rtt.h>
namespace bbr
{
class BbrAlgorithm
{
public:
void on_packet_sent(uint64_t pkt_no,
size_t bytes, size_t bytes_in_flight,
bool need_retransmitted,
time::Timestamp sent_time);
void on_congestion_event(
size_t prior_inflight,
time::Timestamp at_time,
const std::vector<internal::AckedPacket>& acked_packets,
const std::vector<internal::LostPacket>& lost_packets);
size_t can_send(size_t bytes_inflight) const;
size_t min_cwnd() const {return params_.min_cwnd;}
size_t cwnd() const { return cur_cwnd_;}
size_t target_cwnd(float gain);
common::Random& random() { return random_; }
Bbrparams& params() { return params_;}
size_t target_inflight() const;
private:
void update_cwnd(size_t bytes_acked);
void update_pacing_rate(size_t bytes_acked);
size_t cwnd_upper_limit();
void on_exit_quiescence(time::Timestamp at_time);
private:
Bbrparams params_;
common::Random random_;
const size_t init_cwnd_;
size_t cur_cwnd_;
common::BitRate pacing_rate_;
BbrModel model_;
BbrMode cur_mode_;
BbrStartupMode mode_start_up_;
BbrDrainMode mode_drain_;
BbrProbeBandwidth mode_probe_bw_;
BbrProbeRtt mode_probe_rtt_;
time::Timestamp last_quiescence_start_;
};
}
#endif