Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Public API: none. Wire: none.
## Required

- [Redundant failover drift](/quest/m1/test-flakes-2/redundant-failover-drift.md) - a stitching TS export switches back to the surviving importer behind bufferbloat instead of failing on a stalled clock
- [moq-ffi cancel during connect](/quest/m1/test-flakes-2/ffi-cancel-connect.md) - `client_cancel_aborts_a_pending_connect` orders its cancel deterministically, fixing the code if the race is real
- [macOS QUIC connects](/quest/m1/test-flakes-2/macos-quic-connect.md) - moq-tokio's loopback QUIC tests stop timing out on the macOS Platform job

## Related
Expand Down
20 changes: 0 additions & 20 deletions quest/m1/test-flakes-2/ffi-cancel-connect.md

This file was deleted.

38 changes: 22 additions & 16 deletions rs/moq-ffi/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6051,34 +6051,40 @@ async fn session_protocol_codes_cross_the_ffi() {
}
#[tokio::test]
async fn client_cancel_aborts_a_pending_connect() {
let server = MoqServer::new(MoqServerConfig {
bind: Some("127.0.0.1:0".into()),
tls: localhost_tls(),
..Default::default()
})
.unwrap();
let addr = server.listen().await.expect("listen failed");
// A bound socket that never answers, so the QUIC handshake can't finish before cancel.
// A real server would not do: the dial establishes without the server accepting.
let silent = std::net::UdpSocket::bind("127.0.0.1:0").unwrap();
let addr = silent.local_addr().unwrap();

let client = MoqClient::new(MoqClientConfig {
tls: insecure_tls(),
bind: Some("127.0.0.1:0".into()),
once: true,
websocket: MoqWebSocketConfig {
enabled: Some(false),
delay_us: None,
},
..Default::default()
})
.unwrap();

// The server never accepts, so connect parks in established().
let connecting = client.clone();
let connect = spawn_parked(async move { connecting.connect(format!("https://{addr}")).await }).await;
// Poll in place rather than spawning, so cancel lands before the next poll.
let mut connect = std::pin::pin!(client.connect(format!("https://{addr}")));
let first = std::future::poll_fn(|cx| std::task::Poll::Ready(connect.as_mut().poll(cx))).await;
assert!(
first.is_pending(),
Comment thread
kixelated marked this conversation as resolved.
Resolved
"connect resolved before cancel: {:?}",
first.map(|result| result.map(|_| "session")),
);

client.cancel();

let connect_err = tokio::time::timeout(TIMEOUT, connect)
.await
.expect("connect task timed out")
.expect("connect task panicked");
assert!(matches!(connect_err, Err(MoqError::Cancelled)));
server.cancel();
let connect_err = tokio::time::timeout(TIMEOUT, connect).await.expect("connect timed out");
assert!(
matches!(connect_err, Err(MoqError::Cancelled)),
"connect returned {:?}",
connect_err.map(|_| "session"),
);
}

#[tokio::test]
Expand Down