From afcf94f2c7e18d5654cfe0db2708aacabd727172 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 27 Mar 2024 12:08:38 +0200 Subject: [PATCH] Fix merge --- neqo-transport/src/connection/mod.rs | 2 +- neqo-transport/src/connection/tests/ecn.rs | 13 +++++++------ neqo-transport/src/connection/tests/mod.rs | 8 -------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/neqo-transport/src/connection/mod.rs b/neqo-transport/src/connection/mod.rs index 9baa583cd2..e27cadd8e7 100644 --- a/neqo-transport/src/connection/mod.rs +++ b/neqo-transport/src/connection/mod.rs @@ -19,7 +19,7 @@ use std::{ use neqo_common::{ event::Provider as EventProvider, hex, hex_snip_middle, hrtime, qdebug, qerror, qinfo, - qlog::NeqoQlog, qtrace, qwarn, Datagram, Decoder, Encoder, IpTos, Role, + qlog::NeqoQlog, qtrace, qwarn, Datagram, Decoder, Encoder, Role, }; use neqo_crypto::{ agent::CertificateInfo, Agent, AntiReplay, AuthenticationStatus, Cipher, Client, Group, diff --git a/neqo-transport/src/connection/tests/ecn.rs b/neqo-transport/src/connection/tests/ecn.rs index c41a6bb977..ef6c189221 100644 --- a/neqo-transport/src/connection/tests/ecn.rs +++ b/neqo-transport/src/connection/tests/ecn.rs @@ -9,7 +9,7 @@ use neqo_common::{qwarn, Datagram, IpTosEcn}; use test_fixture::now; -use super::{connect_force_idle_with_modifier, send_something_with_modifier}; +use super::{connect_force_idle_with_modifier, send_something_with_modifier, DatagramModifier}; use crate::{ connection::tests::{connect_force_idle, default_client, default_server, send_something}, ecn::ECN_TEST_COUNT, @@ -23,7 +23,7 @@ fn assert_ecn_disabled(d: &Datagram) { assert_eq!(IpTosEcn::from(d.tos()), IpTosEcn::default()); } -fn connect_and_send_something_with_modifier(mut modifier: impl FnMut(&mut Datagram)) -> Datagram { +fn connect_and_send_something_with_modifier(mut modifier: impl DatagramModifier) -> Datagram { let now = now(); let mut client = default_client(); let mut server = default_server(); @@ -47,26 +47,27 @@ fn connect_and_send_something_with_modifier(mut modifier: impl FnMut(&mut Datagr send_something(&mut client, now) } -fn set_tos(d: &mut Datagram, ecn: IpTosEcn) { +fn set_tos(mut d: Datagram, ecn: IpTosEcn) -> neqo_common::Datagram { qwarn!("Setting ECN to {:?}", ecn); d.set_tos(ecn.into()); + d } #[test] fn disables_when_bleached() { - let pkt = connect_and_send_something_with_modifier(|d| set_tos(d, IpTosEcn::default())); + let pkt = connect_and_send_something_with_modifier(|d| Some(set_tos(d, IpTosEcn::default()))); assert_ecn_disabled(&pkt); } #[test] fn disables_when_remarked() { - let pkt = connect_and_send_something_with_modifier(|d| set_tos(d, IpTosEcn::Ect1)); + let pkt = connect_and_send_something_with_modifier(|d| Some(set_tos(d, IpTosEcn::Ect1))); assert_ecn_disabled(&pkt); } #[test] fn stay_enabled_under_ce() { - let pkt = connect_and_send_something_with_modifier(|d| set_tos(d, IpTosEcn::Ce)); + let pkt = connect_and_send_something_with_modifier(|d| Some(set_tos(d, IpTosEcn::Ce))); assert_ecn_enabled(&pkt); } diff --git a/neqo-transport/src/connection/tests/mod.rs b/neqo-transport/src/connection/tests/mod.rs index bf712f83fe..303fe066c4 100644 --- a/neqo-transport/src/connection/tests/mod.rs +++ b/neqo-transport/src/connection/tests/mod.rs @@ -620,14 +620,6 @@ fn send_something(sender: &mut Connection, now: Instant) -> Datagram { send_something_with_modifier(sender, now, Some) } -fn send_something_with_modifier( - sender: &mut Connection, - now: Instant, - modifier: impl FnMut(&mut Datagram), -) -> Datagram { - send_something_paced_with_modifier(sender, now, false, modifier).0 -} - /// Send something on a stream from `sender` to `receiver`. /// Return any ACK that might result. fn send_and_receive(