summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/src/cc/tests
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/neqo-transport/src/cc/tests')
-rw-r--r--third_party/rust/neqo-transport/src/cc/tests/cubic.rs34
-rw-r--r--third_party/rust/neqo-transport/src/cc/tests/new_reno.rs89
2 files changed, 68 insertions, 55 deletions
diff --git a/third_party/rust/neqo-transport/src/cc/tests/cubic.rs b/third_party/rust/neqo-transport/src/cc/tests/cubic.rs
index 2e0200fd6d..8ff591cb47 100644
--- a/third_party/rust/neqo-transport/src/cc/tests/cubic.rs
+++ b/third_party/rust/neqo-transport/src/cc/tests/cubic.rs
@@ -12,6 +12,7 @@ use std::{
time::{Duration, Instant},
};
+use neqo_common::IpTosEcn;
use test_fixture::now;
use crate::{
@@ -41,11 +42,12 @@ fn fill_cwnd(cc: &mut ClassicCongestionControl<Cubic>, mut next_pn: u64, now: In
while cc.bytes_in_flight() < cc.cwnd() {
let sent = SentPacket::new(
PacketType::Short,
- next_pn, // pn
- now, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ next_pn,
+ IpTosEcn::default(),
+ now,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
);
cc.on_packet_sent(&sent);
next_pn += 1;
@@ -56,11 +58,12 @@ fn fill_cwnd(cc: &mut ClassicCongestionControl<Cubic>, mut next_pn: u64, now: In
fn ack_packet(cc: &mut ClassicCongestionControl<Cubic>, pn: u64, now: Instant) {
let acked = SentPacket::new(
PacketType::Short,
- pn, // pn
- now, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ pn,
+ IpTosEcn::default(),
+ now,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
);
cc.on_packets_acked(&[acked], &RTT_ESTIMATE, now);
}
@@ -69,11 +72,12 @@ fn packet_lost(cc: &mut ClassicCongestionControl<Cubic>, pn: u64) {
const PTO: Duration = Duration::from_millis(120);
let p_lost = SentPacket::new(
PacketType::Short,
- pn, // pn
- now(), // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ pn,
+ IpTosEcn::default(),
+ now(),
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
);
cc.on_packets_lost(None, None, PTO, &[p_lost]);
}
diff --git a/third_party/rust/neqo-transport/src/cc/tests/new_reno.rs b/third_party/rust/neqo-transport/src/cc/tests/new_reno.rs
index 4cc20de5a7..0cc560bf2b 100644
--- a/third_party/rust/neqo-transport/src/cc/tests/new_reno.rs
+++ b/third_party/rust/neqo-transport/src/cc/tests/new_reno.rs
@@ -8,6 +8,7 @@
use std::time::Duration;
+use neqo_common::IpTosEcn;
use test_fixture::now;
use crate::{
@@ -44,59 +45,66 @@ fn issue_876() {
let sent_packets = &[
SentPacket::new(
PacketType::Short,
- 1, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE - 1, // size
+ 1,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE - 1,
),
SentPacket::new(
PacketType::Short,
- 2, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE - 2, // size
+ 2,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE - 2,
),
SentPacket::new(
PacketType::Short,
- 3, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ 3,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
),
SentPacket::new(
PacketType::Short,
- 4, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ 4,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
),
SentPacket::new(
PacketType::Short,
- 5, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ 5,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
),
SentPacket::new(
PacketType::Short,
- 6, // pn
- time_before, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ 6,
+ IpTosEcn::default(),
+ time_before,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
),
SentPacket::new(
PacketType::Short,
- 7, // pn
- time_after, // time sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE - 3, // size
+ 7,
+ IpTosEcn::default(),
+ time_after,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE - 3,
),
];
@@ -146,11 +154,12 @@ fn issue_1465() {
let mut next_packet = |now| {
let p = SentPacket::new(
PacketType::Short,
- pn, // pn
- now, // time_sent
- true, // ack eliciting
- Vec::new(), // tokens
- MAX_DATAGRAM_SIZE, // size
+ pn,
+ IpTosEcn::default(),
+ now,
+ true,
+ Vec::new(),
+ MAX_DATAGRAM_SIZE,
);
pn += 1;
p