fix(client): validate blocking receive lifecycle before socket I/O
Rust CI / cargo fmt (push) Successful in 15s
Rust CI / cargo check (x86_64-unknown-linux-gnu) (push) Successful in 28s
Rust CI / cargo clippy (push) Successful in 31s
Rust CI / cargo check (x86_64-unknown-linux-musl) (push) Failing after 9s
Rust CI / cargo test (x86_64-unknown-linux-musl) (push) Failing after 10s
Rust CI / cargo doc (push) Successful in 23s
Rust CI / cargo test (x86_64-unknown-linux-gnu) (push) Successful in 1m10s
Fuzz Smoke / cargo fuzz smoke (push) Failing after 29s
Supply chain / cargo-deny advisories (push) Successful in 6s
Supply chain / cargo-deny bans licenses sources (push) Successful in 5s
Supply chain / actionlint (push) Successful in 3s
Netem Interop / netem interop (push) Successful in 59s
Rust CI / cargo fmt (push) Successful in 15s
Rust CI / cargo check (x86_64-unknown-linux-gnu) (push) Successful in 28s
Rust CI / cargo clippy (push) Successful in 31s
Rust CI / cargo check (x86_64-unknown-linux-musl) (push) Failing after 9s
Rust CI / cargo test (x86_64-unknown-linux-musl) (push) Failing after 10s
Rust CI / cargo doc (push) Successful in 23s
Rust CI / cargo test (x86_64-unknown-linux-gnu) (push) Successful in 1m10s
Fuzz Smoke / cargo fuzz smoke (push) Failing after 29s
Supply chain / cargo-deny advisories (push) Successful in 6s
Supply chain / cargo-deny bans licenses sources (push) Successful in 5s
Supply chain / actionlint (push) Successful in 3s
Netem Interop / netem interop (push) Successful in 59s
Blocking receives previously checked lifecycle only after a datagram arrived, allowing invalid operations to block or return empty success after timeout. Reuse session validation before socket access and cover connected, closed, and no-test-completed states through public APIs.
This commit is contained in:
5 files changed
+80
-4
No files matched your search
@@ -1,5 +1,31 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn receive_before_open_returns_not_open_without_datagrams() {
|
||||
let peer = std::net::UdpSocket::bind("127.0.0.1:0").unwrap();
|
||||
let mut config = default_test_config(peer.local_addr().unwrap());
|
||||
// Bound the old implementation's blocking receive without sending a packet.
|
||||
config.socket_config.recv_timeout = Some(Duration::from_millis(50));
|
||||
let mut client = Client::connect(config).unwrap();
|
||||
|
||||
let results = [
|
||||
client.recv_once(),
|
||||
client.recv_available(RecvBudget { max_packets: 1 }),
|
||||
client.recv_available(RecvBudget { max_packets: 0 }),
|
||||
];
|
||||
assert!(
|
||||
matches!(
|
||||
results,
|
||||
[
|
||||
Err(ClientError::NotOpen),
|
||||
Err(ClientError::NotOpen),
|
||||
Err(ClientError::NotOpen)
|
||||
]
|
||||
),
|
||||
"unexpected receive results: {results:?}"
|
||||
);
|
||||
}
|
||||
|
||||
// Untrusted returned intervals must be rejected before managed scheduling,
|
||||
// even when loose negotiation permits legitimate server restrictions.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user