diff --git a/quest/m2/README.md b/quest/m2/README.md index a5e8e040606..11885c53445 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -188,7 +188,6 @@ lite-07; bitrate enforcement is not part of this release. - [Publisher timeliness at relay ingest](/quest/m2/qos-publisher-timeliness.md) - follow-on capability after the release contract is stable -- [Auth serve bound address](/quest/m2/auth-serve-bound-addr.md) - `moq auth serve` logs the port it actually bound - [H.264 parsing with maintained crates](/quest/m2/h264-reader.md) - moq-mux parses SPS VUI with h264-reader and shares one bit reader across codec config parsers - [Relay metrics through prometheus-client](/quest/m2/relay-prometheus-client.md) - `/metrics` renders through the maintained client with the same series - [moq-transport finish interop](/quest/m2/ietf-finish.md) - the interop `finish` case runs on every even moq-transport draft instead of being skipped diff --git a/quest/m2/auth-serve-bound-addr.md b/quest/m2/auth-serve-bound-addr.md deleted file mode 100644 index ffa4fbdc2fd..00000000000 --- a/quest/m2/auth-serve-bound-addr.md +++ /dev/null @@ -1,13 +0,0 @@ -# [XS] Auth serve logs the address it bound - -## Goal - -`moq auth serve --listen 127.0.0.1:0` logs the port the OS actually assigned, -not port 0, so scripts and tests can find the server. - -## Plan - -- In `Serve::run` (`rs/moq-cli/src/auth.rs`), log `listener.local_addr()` - after binding instead of the configured `addr`. -- Found while abandoning `quest/m1/test-flakes-2/auth-serve-signals.md` - (#5707). diff --git a/rs/moq-cli/src/auth.rs b/rs/moq-cli/src/auth.rs index c626fd5025c..e2676cfbdca 100644 --- a/rs/moq-cli/src/auth.rs +++ b/rs/moq-cli/src/auth.rs @@ -577,6 +577,7 @@ impl Serve { let listener = tokio::net::TcpListener::bind(addr) .await .with_context(|| format!("failed to bind {addr}"))?; + let addr = listener.local_addr().context("failed to read the bound address")?; tracing::info!(%addr, url = ?self.mesh_url, "mesh coordinator listening"); mesh = Some((coordinator.clone(), listener)); server = server.with_mesh(coordinator); @@ -593,6 +594,8 @@ impl Serve { let listener = tokio::net::TcpListener::bind(addr) .await .with_context(|| format!("failed to bind {addr}"))?; + // Log the bound address, so `--listen 127.0.0.1:0` reports the port the OS picked. + let addr = listener.local_addr().context("failed to read the bound address")?; tracing::info!(%addr, "auth server listening"); server.serve(listener).await?; } diff --git a/rs/moq-cli/tests/integration/auth_serve.rs b/rs/moq-cli/tests/integration/auth_serve.rs index 3359dba336b..837012e74d1 100644 --- a/rs/moq-cli/tests/integration/auth_serve.rs +++ b/rs/moq-cli/tests/integration/auth_serve.rs @@ -35,6 +35,14 @@ async fn stops_on(signal: libc::c_int) { kio::clock::timeout(TIMEOUT, async { while let Some(line) = lines.next_line().await.expect("read stderr") { if line.contains("auth server listening") { + // The line names the port the OS assigned, not the requested port 0. + let port = line + .split("127.0.0.1:") + .nth(1) + .and_then(|rest| rest.split(|c: char| !c.is_ascii_digit()).next()) + .and_then(|port| port.parse::().ok()) + .unwrap_or_else(|| panic!("no bound address in {line:?}")); + assert_ne!(port, 0, "logged the requested port instead of the bound one: {line:?}"); return; } }