rwebtransport 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +666 -666
- package/Cargo.toml +31 -31
- package/LICENSE +202 -202
- package/NOTICE +41 -41
- package/README.md +550 -550
- package/crates/echo-server/Cargo.toml +20 -20
- package/crates/echo-server/src/main.rs +666 -666
- package/crates/native/Cargo.toml +23 -23
- package/crates/native/src/config.rs +129 -129
- package/crates/native/src/driver.rs +463 -463
- package/crates/native/src/lib.rs +821 -821
- package/crates/native/src/server.rs +718 -718
- package/crates/native/src/session.rs +1191 -1191
- package/crates/native/src/tls.rs +96 -96
- package/crates/wtcore/Cargo.toml +15 -15
- package/crates/wtcore/src/h3.rs +226 -226
- package/crates/wtcore/src/lib.rs +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +80 -79
- package/prebuilds/darwin-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-x64/rwebtransport.node +0 -0
- package/prebuilds/win32-x64/rwebtransport.node +0 -0
- package/scripts/bench.mjs +180 -180
- package/scripts/build.js +67 -67
- package/scripts/postinstall.js +67 -67
- package/scripts/setup-unix.sh +129 -129
- package/scripts/setup-windows.ps1 +229 -229
- package/vendor/quiche/AGENTS.md +75 -75
- package/vendor/quiche/COPYING +23 -23
- package/vendor/quiche/Cargo.lock +1212 -1212
- package/vendor/quiche/Cargo.toml +215 -215
- package/vendor/quiche/README.md +466 -466
- package/vendor/quiche/examples/Makefile +46 -46
- package/vendor/quiche/examples/README.md +20 -20
- package/vendor/quiche/examples/cert-big.crt +90 -90
- package/vendor/quiche/examples/cert.crt +18 -18
- package/vendor/quiche/examples/cert.key +28 -28
- package/vendor/quiche/examples/client.c +343 -343
- package/vendor/quiche/examples/client.rs +281 -281
- package/vendor/quiche/examples/gen-certs.sh +15 -15
- package/vendor/quiche/examples/http3-client.c +473 -473
- package/vendor/quiche/examples/http3-client.rs +349 -349
- package/vendor/quiche/examples/http3-server.c +614 -614
- package/vendor/quiche/examples/http3-server.rs +680 -680
- package/vendor/quiche/examples/qpack-decode.rs +87 -87
- package/vendor/quiche/examples/qpack-encode.rs +88 -88
- package/vendor/quiche/examples/rootca.crt +21 -21
- package/vendor/quiche/examples/server.c +529 -529
- package/vendor/quiche/examples/server.rs +529 -529
- package/vendor/quiche/include/quiche.h +1282 -1282
- package/vendor/quiche/src/buffers.rs +105 -105
- package/vendor/quiche/src/build.rs +66 -66
- package/vendor/quiche/src/cid.rs +1079 -1079
- package/vendor/quiche/src/crypto/boringssl.rs +373 -373
- package/vendor/quiche/src/crypto/mod.rs +671 -671
- package/vendor/quiche/src/dgram.rs +118 -118
- package/vendor/quiche/src/error.rs +263 -263
- package/vendor/quiche/src/ffi.rs +2290 -2290
- package/vendor/quiche/src/flowcontrol.rs +246 -246
- package/vendor/quiche/src/frame.rs +2172 -2172
- package/vendor/quiche/src/h3/AGENTS.md +54 -54
- package/vendor/quiche/src/h3/ffi.rs +442 -442
- package/vendor/quiche/src/h3/frame.rs +1404 -1404
- package/vendor/quiche/src/h3/mod.rs +8223 -8223
- package/vendor/quiche/src/h3/qpack/decoder.rs +288 -288
- package/vendor/quiche/src/h3/qpack/encoder.rs +235 -235
- package/vendor/quiche/src/h3/qpack/mod.rs +202 -202
- package/vendor/quiche/src/h3/qpack/static_table.rs +323 -323
- package/vendor/quiche/src/h3/stream.rs +1595 -1595
- package/vendor/quiche/src/lib.rs +9556 -9556
- package/vendor/quiche/src/minmax.rs +446 -446
- package/vendor/quiche/src/packet.rs +2334 -2334
- package/vendor/quiche/src/path.rs +1374 -1374
- package/vendor/quiche/src/pmtud.rs +652 -652
- package/vendor/quiche/src/rand.rs +64 -64
- package/vendor/quiche/src/range_buf.rs +186 -186
- package/vendor/quiche/src/ranges.rs +755 -755
- package/vendor/quiche/src/recovery/AGENTS.md +80 -80
- package/vendor/quiche/src/recovery/bandwidth.rs +565 -565
- package/vendor/quiche/src/recovery/bytes_in_flight.rs +179 -179
- package/vendor/quiche/src/recovery/congestion/cubic.rs +1038 -1038
- package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +514 -514
- package/vendor/quiche/src/recovery/congestion/hystart.rs +241 -241
- package/vendor/quiche/src/recovery/congestion/mod.rs +361 -361
- package/vendor/quiche/src/recovery/congestion/prr.rs +238 -238
- package/vendor/quiche/src/recovery/congestion/recovery.rs +1170 -1170
- package/vendor/quiche/src/recovery/congestion/reno.rs +291 -291
- package/vendor/quiche/src/recovery/congestion/test_sender.rs +201 -201
- package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +1947 -1947
- package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +158 -158
- package/vendor/quiche/src/recovery/gcongestion/bbr.rs +37 -37
- package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +120 -120
- package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +318 -318
- package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +784 -784
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +729 -729
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +175 -175
- package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +190 -190
- package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +855 -855
- package/vendor/quiche/src/recovery/gcongestion/mod.rs +275 -275
- package/vendor/quiche/src/recovery/gcongestion/pacer.rs +294 -294
- package/vendor/quiche/src/recovery/gcongestion/recovery.rs +1384 -1384
- package/vendor/quiche/src/recovery/mod.rs +3086 -3086
- package/vendor/quiche/src/recovery/rtt.rs +152 -152
- package/vendor/quiche/src/stream/mod.rs +2210 -2210
- package/vendor/quiche/src/stream/recv_buf.rs +1236 -1236
- package/vendor/quiche/src/stream/send_buf.rs +849 -849
- package/vendor/quiche/src/test_utils.rs +681 -681
- package/vendor/quiche/src/tests.rs +12922 -12922
- package/vendor/quiche/src/tls/boringssl.rs +375 -375
- package/vendor/quiche/src/tls/mod.rs +1245 -1245
- package/vendor/quiche/src/transport_params.rs +628 -628
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
// Copyright (c) 2015 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
|
-
// Copyright (C) 2023, Cloudflare, Inc.
|
|
6
|
-
// All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
// Redistribution and use in source and binary forms, with or without
|
|
9
|
-
// modification, are permitted provided that the following conditions are
|
|
10
|
-
// met:
|
|
11
|
-
//
|
|
12
|
-
// * Redistributions of source code must retain the above copyright notice,
|
|
13
|
-
// this list of conditions and the following disclaimer.
|
|
14
|
-
//
|
|
15
|
-
// * Redistributions in binary form must reproduce the above copyright
|
|
16
|
-
// notice, this list of conditions and the following disclaimer in the
|
|
17
|
-
// documentation and/or other materials provided with the distribution.
|
|
18
|
-
//
|
|
19
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
20
|
-
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
-
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
22
|
-
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
23
|
-
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
24
|
-
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
25
|
-
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
26
|
-
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
27
|
-
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
28
|
-
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
29
|
-
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
|
|
31
|
-
use std::time::Instant;
|
|
32
|
-
|
|
33
|
-
use crate::recovery::gcongestion::bbr2::Params;
|
|
34
|
-
use crate::recovery::gcongestion::Acked;
|
|
35
|
-
use crate::recovery::gcongestion::Lost;
|
|
36
|
-
use crate::recovery::RecoveryStats;
|
|
37
|
-
|
|
38
|
-
use super::mode::Cycle;
|
|
39
|
-
use super::mode::Mode;
|
|
40
|
-
use super::mode::ModeImpl;
|
|
41
|
-
use super::network_model::BBRv2NetworkModel;
|
|
42
|
-
use super::BBRv2CongestionEvent;
|
|
43
|
-
use super::Limits;
|
|
44
|
-
|
|
45
|
-
#[derive(Debug)]
|
|
46
|
-
pub(super) struct ProbeRTT {
|
|
47
|
-
pub(super) model: BBRv2NetworkModel,
|
|
48
|
-
pub(super) cycle: Cycle,
|
|
49
|
-
exit_time: Option<Instant>,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
impl ProbeRTT {
|
|
53
|
-
pub(super) fn new(model: BBRv2NetworkModel, cycle: Cycle) -> Self {
|
|
54
|
-
ProbeRTT {
|
|
55
|
-
model,
|
|
56
|
-
cycle,
|
|
57
|
-
exit_time: None,
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
fn into_probe_bw(
|
|
62
|
-
mut self, now: Instant, congestion_event: Option<&BBRv2CongestionEvent>,
|
|
63
|
-
params: &Params,
|
|
64
|
-
) -> Mode {
|
|
65
|
-
self.leave(now, congestion_event);
|
|
66
|
-
let mut next_mode = Mode::probe_bw(self.model, self.cycle);
|
|
67
|
-
next_mode.enter(now, congestion_event, params);
|
|
68
|
-
next_mode
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fn inflight_target(&self, params: &Params) -> usize {
|
|
72
|
-
self.model.bdp(
|
|
73
|
-
self.model.max_bandwidth(),
|
|
74
|
-
params.probe_rtt_inflight_target_bdp_fraction,
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
impl ModeImpl for ProbeRTT {
|
|
80
|
-
#[cfg(feature = "qlog")]
|
|
81
|
-
fn state_str(&self) -> &'static str {
|
|
82
|
-
"bbr_probe_rtt"
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
fn is_probing_for_bandwidth(&self) -> bool {
|
|
86
|
-
false
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
fn on_congestion_event(
|
|
90
|
-
mut self, _prior_in_flight: usize, event_time: Instant,
|
|
91
|
-
_acked_packets: &[Acked], _lost_packets: &[Lost],
|
|
92
|
-
congestion_event: &mut BBRv2CongestionEvent,
|
|
93
|
-
_target_bytes_inflight: usize, params: &Params,
|
|
94
|
-
_recovery_stats: &mut RecoveryStats, _cwnd: usize,
|
|
95
|
-
) -> Mode {
|
|
96
|
-
match self.exit_time {
|
|
97
|
-
None => {
|
|
98
|
-
if congestion_event.bytes_in_flight <=
|
|
99
|
-
self.inflight_target(params)
|
|
100
|
-
{
|
|
101
|
-
self.exit_time = Some(
|
|
102
|
-
congestion_event.event_time + params.probe_rtt_duration,
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
Mode::ProbeRTT(self)
|
|
106
|
-
},
|
|
107
|
-
Some(exit_time) =>
|
|
108
|
-
if congestion_event.event_time > exit_time {
|
|
109
|
-
self.into_probe_bw(event_time, Some(congestion_event), params)
|
|
110
|
-
} else {
|
|
111
|
-
Mode::ProbeRTT(self)
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
fn get_cwnd_limits(&self, params: &Params) -> Limits<usize> {
|
|
117
|
-
let inflight_upper_bound = self
|
|
118
|
-
.model
|
|
119
|
-
.inflight_lo()
|
|
120
|
-
.min(self.model.inflight_hi_with_headroom(params));
|
|
121
|
-
Limits::no_greater_than(
|
|
122
|
-
inflight_upper_bound.min(self.inflight_target(params)),
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
fn on_exit_quiescence(
|
|
127
|
-
self, now: Instant, _quiescence_start_time: Instant, params: &Params,
|
|
128
|
-
) -> Mode {
|
|
129
|
-
match self.exit_time {
|
|
130
|
-
None => self.into_probe_bw(now, None, params),
|
|
131
|
-
Some(exit_time) if now > exit_time =>
|
|
132
|
-
self.into_probe_bw(now, None, params),
|
|
133
|
-
Some(_) => Mode::ProbeRTT(self),
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
fn enter(
|
|
138
|
-
&mut self, _now: Instant,
|
|
139
|
-
_congestion_event: Option<&BBRv2CongestionEvent>, params: &Params,
|
|
140
|
-
) {
|
|
141
|
-
self.model.set_pacing_gain(params.probe_rtt_pacing_gain);
|
|
142
|
-
self.model.set_cwnd_gain(params.probe_rtt_cwnd_gain);
|
|
143
|
-
self.exit_time = None;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
fn leave(
|
|
147
|
-
&mut self, _now: Instant,
|
|
148
|
-
_congestion_event: Option<&BBRv2CongestionEvent>,
|
|
149
|
-
) {
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#[cfg(test)]
|
|
154
|
-
mod tests {
|
|
155
|
-
use super::*;
|
|
156
|
-
use crate::recovery::gcongestion::bbr2::DEFAULT_PARAMS;
|
|
157
|
-
use crate::BbrParams;
|
|
158
|
-
use std::time::Duration;
|
|
159
|
-
|
|
160
|
-
#[test]
|
|
161
|
-
fn probe_rtt_params() {
|
|
162
|
-
let custom_bbr_settings = BbrParams {
|
|
163
|
-
probe_rtt_pacing_gain: Some(0.8),
|
|
164
|
-
probe_rtt_cwnd_gain: Some(0.5),
|
|
165
|
-
..Default::default()
|
|
166
|
-
};
|
|
167
|
-
let params = &DEFAULT_PARAMS.with_overrides(&custom_bbr_settings);
|
|
168
|
-
|
|
169
|
-
let model = BBRv2NetworkModel::new(params, Duration::from_millis(333));
|
|
170
|
-
let mut probe_rtt = ProbeRTT::new(model, Cycle::default());
|
|
171
|
-
probe_rtt.enter(Instant::now(), None, params);
|
|
172
|
-
assert_eq!(probe_rtt.model.pacing_gain(), 0.8);
|
|
173
|
-
assert_eq!(probe_rtt.model.cwnd_gain(), 0.5);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
1
|
+
// Copyright (c) 2015 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
|
+
// Copyright (C) 2023, Cloudflare, Inc.
|
|
6
|
+
// All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
// Redistribution and use in source and binary forms, with or without
|
|
9
|
+
// modification, are permitted provided that the following conditions are
|
|
10
|
+
// met:
|
|
11
|
+
//
|
|
12
|
+
// * Redistributions of source code must retain the above copyright notice,
|
|
13
|
+
// this list of conditions and the following disclaimer.
|
|
14
|
+
//
|
|
15
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
16
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
17
|
+
// documentation and/or other materials provided with the distribution.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
20
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
22
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
23
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
24
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
25
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
26
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
27
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
28
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
29
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
use std::time::Instant;
|
|
32
|
+
|
|
33
|
+
use crate::recovery::gcongestion::bbr2::Params;
|
|
34
|
+
use crate::recovery::gcongestion::Acked;
|
|
35
|
+
use crate::recovery::gcongestion::Lost;
|
|
36
|
+
use crate::recovery::RecoveryStats;
|
|
37
|
+
|
|
38
|
+
use super::mode::Cycle;
|
|
39
|
+
use super::mode::Mode;
|
|
40
|
+
use super::mode::ModeImpl;
|
|
41
|
+
use super::network_model::BBRv2NetworkModel;
|
|
42
|
+
use super::BBRv2CongestionEvent;
|
|
43
|
+
use super::Limits;
|
|
44
|
+
|
|
45
|
+
#[derive(Debug)]
|
|
46
|
+
pub(super) struct ProbeRTT {
|
|
47
|
+
pub(super) model: BBRv2NetworkModel,
|
|
48
|
+
pub(super) cycle: Cycle,
|
|
49
|
+
exit_time: Option<Instant>,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
impl ProbeRTT {
|
|
53
|
+
pub(super) fn new(model: BBRv2NetworkModel, cycle: Cycle) -> Self {
|
|
54
|
+
ProbeRTT {
|
|
55
|
+
model,
|
|
56
|
+
cycle,
|
|
57
|
+
exit_time: None,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn into_probe_bw(
|
|
62
|
+
mut self, now: Instant, congestion_event: Option<&BBRv2CongestionEvent>,
|
|
63
|
+
params: &Params,
|
|
64
|
+
) -> Mode {
|
|
65
|
+
self.leave(now, congestion_event);
|
|
66
|
+
let mut next_mode = Mode::probe_bw(self.model, self.cycle);
|
|
67
|
+
next_mode.enter(now, congestion_event, params);
|
|
68
|
+
next_mode
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fn inflight_target(&self, params: &Params) -> usize {
|
|
72
|
+
self.model.bdp(
|
|
73
|
+
self.model.max_bandwidth(),
|
|
74
|
+
params.probe_rtt_inflight_target_bdp_fraction,
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
impl ModeImpl for ProbeRTT {
|
|
80
|
+
#[cfg(feature = "qlog")]
|
|
81
|
+
fn state_str(&self) -> &'static str {
|
|
82
|
+
"bbr_probe_rtt"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
fn is_probing_for_bandwidth(&self) -> bool {
|
|
86
|
+
false
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
fn on_congestion_event(
|
|
90
|
+
mut self, _prior_in_flight: usize, event_time: Instant,
|
|
91
|
+
_acked_packets: &[Acked], _lost_packets: &[Lost],
|
|
92
|
+
congestion_event: &mut BBRv2CongestionEvent,
|
|
93
|
+
_target_bytes_inflight: usize, params: &Params,
|
|
94
|
+
_recovery_stats: &mut RecoveryStats, _cwnd: usize,
|
|
95
|
+
) -> Mode {
|
|
96
|
+
match self.exit_time {
|
|
97
|
+
None => {
|
|
98
|
+
if congestion_event.bytes_in_flight <=
|
|
99
|
+
self.inflight_target(params)
|
|
100
|
+
{
|
|
101
|
+
self.exit_time = Some(
|
|
102
|
+
congestion_event.event_time + params.probe_rtt_duration,
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
Mode::ProbeRTT(self)
|
|
106
|
+
},
|
|
107
|
+
Some(exit_time) =>
|
|
108
|
+
if congestion_event.event_time > exit_time {
|
|
109
|
+
self.into_probe_bw(event_time, Some(congestion_event), params)
|
|
110
|
+
} else {
|
|
111
|
+
Mode::ProbeRTT(self)
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
fn get_cwnd_limits(&self, params: &Params) -> Limits<usize> {
|
|
117
|
+
let inflight_upper_bound = self
|
|
118
|
+
.model
|
|
119
|
+
.inflight_lo()
|
|
120
|
+
.min(self.model.inflight_hi_with_headroom(params));
|
|
121
|
+
Limits::no_greater_than(
|
|
122
|
+
inflight_upper_bound.min(self.inflight_target(params)),
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
fn on_exit_quiescence(
|
|
127
|
+
self, now: Instant, _quiescence_start_time: Instant, params: &Params,
|
|
128
|
+
) -> Mode {
|
|
129
|
+
match self.exit_time {
|
|
130
|
+
None => self.into_probe_bw(now, None, params),
|
|
131
|
+
Some(exit_time) if now > exit_time =>
|
|
132
|
+
self.into_probe_bw(now, None, params),
|
|
133
|
+
Some(_) => Mode::ProbeRTT(self),
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
fn enter(
|
|
138
|
+
&mut self, _now: Instant,
|
|
139
|
+
_congestion_event: Option<&BBRv2CongestionEvent>, params: &Params,
|
|
140
|
+
) {
|
|
141
|
+
self.model.set_pacing_gain(params.probe_rtt_pacing_gain);
|
|
142
|
+
self.model.set_cwnd_gain(params.probe_rtt_cwnd_gain);
|
|
143
|
+
self.exit_time = None;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
fn leave(
|
|
147
|
+
&mut self, _now: Instant,
|
|
148
|
+
_congestion_event: Option<&BBRv2CongestionEvent>,
|
|
149
|
+
) {
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#[cfg(test)]
|
|
154
|
+
mod tests {
|
|
155
|
+
use super::*;
|
|
156
|
+
use crate::recovery::gcongestion::bbr2::DEFAULT_PARAMS;
|
|
157
|
+
use crate::BbrParams;
|
|
158
|
+
use std::time::Duration;
|
|
159
|
+
|
|
160
|
+
#[test]
|
|
161
|
+
fn probe_rtt_params() {
|
|
162
|
+
let custom_bbr_settings = BbrParams {
|
|
163
|
+
probe_rtt_pacing_gain: Some(0.8),
|
|
164
|
+
probe_rtt_cwnd_gain: Some(0.5),
|
|
165
|
+
..Default::default()
|
|
166
|
+
};
|
|
167
|
+
let params = &DEFAULT_PARAMS.with_overrides(&custom_bbr_settings);
|
|
168
|
+
|
|
169
|
+
let model = BBRv2NetworkModel::new(params, Duration::from_millis(333));
|
|
170
|
+
let mut probe_rtt = ProbeRTT::new(model, Cycle::default());
|
|
171
|
+
probe_rtt.enter(Instant::now(), None, params);
|
|
172
|
+
assert_eq!(probe_rtt.model.pacing_gain(), 0.8);
|
|
173
|
+
assert_eq!(probe_rtt.model.cwnd_gain(), 0.5);
|
|
174
|
+
}
|
|
175
|
+
}
|