Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Mar 27, 2024
1 parent cf90ee6 commit afcf94f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions neqo-transport/src/connection/tests/ecn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand All @@ -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);
}

Expand Down
8 changes: 0 additions & 8 deletions neqo-transport/src/connection/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit afcf94f

Please sign in to comment.