Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(transport): Remove module_name_repetitions #2311

Merged
merged 8 commits into from
Jan 8, 2025
6 changes: 4 additions & 2 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

// The class implementing a QUIC connection.

#![allow(clippy::module_name_repetitions)]

use std::{
cell::RefCell,
cmp::{max, min},
Expand Down Expand Up @@ -36,7 +38,7 @@ use crate::{
ConnectionIdRef, ConnectionIdStore, LOCAL_ACTIVE_CID_LIMIT,
},
crypto::{Crypto, CryptoDxState, CryptoSpace},
ecn::EcnCount,
ecn,
events::{ConnectionEvent, ConnectionEvents, OutgoingDatagramOutcome},
frame::{
CloseError, Frame, FrameType, FRAME_TYPE_CONNECTION_CLOSE_APPLICATION,
Expand Down Expand Up @@ -3132,7 +3134,7 @@ impl Connection {
&mut self,
space: PacketNumberSpace,
ack_ranges: R,
ack_ecn: Option<EcnCount>,
ack_ecn: Option<ecn::Count>,
ack_delay: u64,
now: Instant,
) where
Expand Down
52 changes: 26 additions & 26 deletions neqo-transport/src/connection/tests/ecn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
new_server, send_and_receive, send_something, send_something_with_modifier,
send_with_modifier_and_receive, DEFAULT_RTT,
},
ecn::{EcnValidationOutcome, ECN_TEST_COUNT},
ecn,
path::MAX_PATH_PROBES,
ConnectionId, ConnectionParameters, StreamType,
};
Expand Down Expand Up @@ -143,21 +143,21 @@ fn stats() {
let mut server = default_server();
connect_force_idle(&mut client, &mut server);

for _ in 0..ECN_TEST_COUNT {
for _ in 0..ecn::TEST_COUNT {
let ack = send_and_receive(&mut client, &mut server, now);
client.process_input(ack.unwrap(), now);
}

for _ in 0..ECN_TEST_COUNT {
for _ in 0..ecn::TEST_COUNT {
let ack = send_and_receive(&mut server, &mut client, now);
server.process_input(ack.unwrap(), now);
}

for stats in [client.stats(), server.stats()] {
for (outcome, count) in stats.ecn_path_validation.iter() {
match outcome {
EcnValidationOutcome::Capable => assert_eq!(*count, 1),
EcnValidationOutcome::NotCapable(_) => assert_eq!(*count, 0),
ecn::ValidationOutcome::Capable => assert_eq!(*count, 1),
ecn::ValidationOutcome::NotCapable(_) => assert_eq!(*count, 0),
}
}

Expand All @@ -182,7 +182,7 @@ fn disables_on_loss() {
let client_pkt = send_something(&mut client, now);
assert_ecn_enabled(client_pkt.tos());

for _ in 0..ECN_TEST_COUNT {
for _ in 0..ecn::TEST_COUNT {
send_something(&mut client, now);
}

Expand All @@ -198,7 +198,7 @@ fn disables_on_remark() {
let mut server = default_server();
connect_force_idle(&mut client, &mut server);

for _ in 0..ECN_TEST_COUNT {
for _ in 0..ecn::TEST_COUNT {
if let Some(ack) = send_with_modifier_and_receive(&mut client, &mut server, now, remark()) {
client.process_input(ack, now);
}
Expand Down Expand Up @@ -373,71 +373,71 @@ fn ecn_migration_zero_burst_all_cases() {

#[test]
fn ecn_migration_noop_bleach_data() {
let (before, after, migrated) = migration_with_modifiers(noop(), bleach(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(noop(), bleach(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration.
assert_ecn_disabled(after); // ECN validation fails after migration due to bleaching.
assert!(migrated);
}

#[test]
fn ecn_migration_noop_remark_data() {
let (before, after, migrated) = migration_with_modifiers(noop(), remark(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(noop(), remark(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration.
assert_ecn_disabled(after); // ECN validation fails after migration due to remarking.
assert!(migrated);
}

#[test]
fn ecn_migration_noop_ce_data() {
let (before, after, migrated) = migration_with_modifiers(noop(), ce(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(noop(), ce(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration.
assert_ecn_enabled(after); // ECN validation concludes after migration, despite all CE marks.
assert!(migrated);
}

#[test]
fn ecn_migration_noop_drop_data() {
let (before, after, migrated) = migration_with_modifiers(noop(), drop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(noop(), drop(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration.
assert_ecn_enabled(after); // Migration failed, ECN on original path is still validated.
assert!(!migrated);
}

#[test]
fn ecn_migration_bleach_noop_data() {
let (before, after, migrated) = migration_with_modifiers(bleach(), noop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(bleach(), noop(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to bleaching.
assert_ecn_enabled(after); // ECN validation concludes after migration.
assert!(migrated);
}

#[test]
fn ecn_migration_bleach_bleach_data() {
let (before, after, migrated) = migration_with_modifiers(bleach(), bleach(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(bleach(), bleach(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to bleaching.
assert_ecn_disabled(after); // ECN validation fails after migration due to bleaching.
assert!(migrated);
}

#[test]
fn ecn_migration_bleach_remark_data() {
let (before, after, migrated) = migration_with_modifiers(bleach(), remark(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(bleach(), remark(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to bleaching.
assert_ecn_disabled(after); // ECN validation fails after migration due to remarking.
assert!(migrated);
}

#[test]
fn ecn_migration_bleach_ce_data() {
let (before, after, migrated) = migration_with_modifiers(bleach(), ce(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(bleach(), ce(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to bleaching.
assert_ecn_enabled(after); // ECN validation concludes after migration, despite all CE marks.
assert!(migrated);
}

#[test]
fn ecn_migration_bleach_drop_data() {
let (before, after, migrated) = migration_with_modifiers(bleach(), drop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(bleach(), drop(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to bleaching.
// Migration failed, ECN on original path is still disabled.
assert_ecn_disabled(after);
Expand All @@ -446,79 +446,79 @@ fn ecn_migration_bleach_drop_data() {

#[test]
fn ecn_migration_remark_noop_data() {
let (before, after, migrated) = migration_with_modifiers(remark(), noop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(remark(), noop(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to remarking.
assert_ecn_enabled(after); // ECN validation succeeds after migration.
assert!(migrated);
}

#[test]
fn ecn_migration_remark_bleach_data() {
let (before, after, migrated) = migration_with_modifiers(remark(), bleach(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(remark(), bleach(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to remarking.
assert_ecn_disabled(after); // ECN validation fails after migration due to bleaching.
assert!(migrated);
}

#[test]
fn ecn_migration_remark_remark_data() {
let (before, after, migrated) = migration_with_modifiers(remark(), remark(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(remark(), remark(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to remarking.
assert_ecn_disabled(after); // ECN validation fails after migration due to remarking.
assert!(migrated);
}

#[test]
fn ecn_migration_remark_ce_data() {
let (before, after, migrated) = migration_with_modifiers(remark(), ce(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(remark(), ce(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to remarking.
assert_ecn_enabled(after); // ECN validation concludes after migration, despite all CE marks.
assert!(migrated);
}

#[test]
fn ecn_migration_remark_drop_data() {
let (before, after, migrated) = migration_with_modifiers(remark(), drop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(remark(), drop(), ecn::TEST_COUNT);
assert_ecn_disabled(before); // ECN validation fails before migration due to remarking.
assert_ecn_disabled(after); // Migration failed, ECN on original path is still disabled.
assert!(!migrated);
}

#[test]
fn ecn_migration_ce_noop_data() {
let (before, after, migrated) = migration_with_modifiers(ce(), noop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(ce(), noop(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration, despite all CE marks.
assert_ecn_enabled(after); // ECN validation concludes after migration.
assert!(migrated);
}

#[test]
fn ecn_migration_ce_bleach_data() {
let (before, after, migrated) = migration_with_modifiers(ce(), bleach(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(ce(), bleach(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration, despite all CE marks.
assert_ecn_disabled(after); // ECN validation fails after migration due to bleaching
assert!(migrated);
}

#[test]
fn ecn_migration_ce_remark_data() {
let (before, after, migrated) = migration_with_modifiers(ce(), remark(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(ce(), remark(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration, despite all CE marks.
assert_ecn_disabled(after); // ECN validation fails after migration due to remarking.
assert!(migrated);
}

#[test]
fn ecn_migration_ce_ce_data() {
let (before, after, migrated) = migration_with_modifiers(ce(), ce(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(ce(), ce(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration, despite all CE marks.
assert_ecn_enabled(after); // ECN validation concludes after migration, despite all CE marks.
assert!(migrated);
}

#[test]
fn ecn_migration_ce_drop_data() {
let (before, after, migrated) = migration_with_modifiers(ce(), drop(), ECN_TEST_COUNT);
let (before, after, migrated) = migration_with_modifiers(ce(), drop(), ecn::TEST_COUNT);
assert_ecn_enabled(before); // ECN validation concludes before migration, despite all CE marks.
// Migration failed, ECN on original path is still enabled.
assert_ecn_enabled(after);
Expand Down
2 changes: 2 additions & 0 deletions neqo-transport/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(clippy::module_name_repetitions)]

use std::{
cell::RefCell,
cmp::{max, min},
Expand Down
Loading
Loading