From dc3d4ca65d3eec5b949cfcee9c77b83402892ffb Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 30 Oct 2026 04:58:45 -0700 Subject: [PATCH 1/2] chore(quest): claim quest/m2/auth-serve-bound-addr.md Quest-Claim: eefb5efa97279ff4 From 2809f046716749c6d0775d759ebab85f07b86bcc Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 30 Oct 2026 05:07:40 -0700 Subject: [PATCH 2/2] fix(cli): log the address auth serve actually bound `moq auth serve --listen 127.0.0.1:0` logged port 0; log `listener.local_addr()` so scripts and tests can find the server. Co-Authored-By: Claude Opus 5.5 --- quest/m2/README.md | 1 - quest/m2/auth-serve-bound-addr.md | 13 ------------- rs/moq-cli/src/auth.rs | 2 ++ rs/moq-cli/tests/integration/auth_serve.rs | 8 ++++++++ 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 quest/m2/auth-serve-bound-addr.md diff --git a/quest/m2/README.md b/quest/m2/README.md index 4f4f2452b0a..250d18cab8b 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -224,7 +224,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 - [Task supervision](/quest/m2/task-supervision.md) - the auth decider loop, stats publisher, and moq-tokio's token and WebSocket internals are supervised like #5447's tasks -- [Auth serve bound address](/quest/m2/auth-serve-bound-addr.md) - `moq auth serve` logs the port it actually bound - [Relay exposes a verified peer address](/quest/m2/relay-peer-addr.md) - WebRTC and other embedded routes know the client's socket address - [RTMP client reports a publish or play error](/quest/m2/rtmp-client-error.md) - a refused publish or play surfaces its reason - [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 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 e50445bb213..08458bb856f 100644 --- a/rs/moq-cli/src/auth.rs +++ b/rs/moq-cli/src/auth.rs @@ -520,6 +520,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 fc160ce52a7..62a7c2311a1 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) { tokio::time::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; } }