fix(test): attendre la libération du port média après l'arrêt
CI / Formatting, tests and builds (push) Successful in 2m45s

Le socket média part avec la tâche interrompue par l'arrêt, un instant
après le retour de stop(): sur le runner de CI, plus lent, le test
the_media_takes_its_port_in_the_firewall_range échouait. Il patiente
jusqu'à deux secondes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Guillaume ASSIERandClaude Opus 5.5 committed 2026-10-30 17:48:55 +01:00
1 parent fdc180543c
commit 19a0902400
1 file changed
+10 -1
+10 -1
View File
@@ -423,7 +423,16 @@ async fn the_media_takes_its_port_in_the_firewall_range() {
let held = std::net::UdpSocket::bind(("0.0.0.0", base));
assert!(held.is_err(), "port {base} should hold the viewer's media");
host.stop().await;
std::net::UdpSocket::bind(("0.0.0.0", base)).expect("released with the share");
// The socket goes with the media task, aborted by the stop: it is freed a
// moment later, not necessarily before `stop` returns.
let deadline = std::time::Instant::now() + Duration::from_secs(2);
while std::net::UdpSocket::bind(("0.0.0.0", base)).is_err() {
assert!(
std::time::Instant::now() < deadline,
"port {base} not released with the share"
);
tokio::time::sleep(Duration::from_millis(20)).await;
}
}
#[tokio::test(flavor = "multi_thread")]