From b1e3abf1fd4c99b9f6ea05e330f9dbbcdfeeb4f9 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 12:11:31 -0700 Subject: [PATCH 1/3] chore(quest): claim quest/m1/broadcast-lifecycle/srt-end.md Quest-Claim: 25d67b283224859f From b2b72a920bf2c2bcb8ecba9733910d4904a26169 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 12:12:17 -0700 Subject: [PATCH 2/3] quest: srt-end is blocked, srt-tokio cannot tell a shutdown from a timeout Co-Authored-By: Claude Opus 5.5 --- quest/m1/broadcast-lifecycle/srt-end.md | 39 ++++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/quest/m1/broadcast-lifecycle/srt-end.md b/quest/m1/broadcast-lifecycle/srt-end.md index 8a215e315ac..c633f4cc6eb 100644 --- a/quest/m1/broadcast-lifecycle/srt-end.md +++ b/quest/m1/broadcast-lifecycle/srt-end.md @@ -11,12 +11,37 @@ socket stream ends), because srt-tokio ends the stream the same way for both. Decided with the maintainer on 2026-10-23: fix it at the source. -- Find how srt-tokio reports a shutdown handshake versus a peer timeout. If - it exposes the difference, use it in both the server and the `Client` - pull (`serve_publish`). -- If it does not, an upstream srt-tokio change is needed: it is outside the - moq-dev and kixelated orgs, so ask before posting there. -- Test both ends with a mocked clock: a silent peer aborts, a clean shutdown - finishes. +Found on 2026-10-24: srt-tokio 0.4.4 (latest, and upstream `main`) cannot +tell them apart. `SrtSocket`'s stream never yields `Err`; its task returns +`()`. In srt-protocol, a peer Shutdown packet, the peer idle timeout, +and a UDP or listener channel error all move the receiver to `Drain` and then +`Closed`, and the private `ConnectionStatus` keeps no cause. The task then +closes the data channel, so moq-srt sees `None` for all three. Statistics +carry no shutdown counter and stop updating at close. + +What would fix it, by owner: + +- Upstream: srt-protocol records why the receiver left `Open` (peer shutdown, + idle timeout, socket closed, local close) and exposes it on + `DuplexConnection`. srt-tokio then yields `Err` (`TimedOut` or + `ConnectionAborted`) before `None` for any cause other than a peer + shutdown or local close. The stream item is already `io::Result`, so no + type changes; moq-srt's `try_next()?` would take the abort arm untouched. + Upstream is unmaintained (see + [SRT on the shared socket](/quest/m2/one-port/srt-demux.md)), and it is + outside the moq-dev and kixelated orgs: ask before posting there. +- In moq-srt: drive sans-io srt-protocol directly, as + [SRT on the shared socket](/quest/m2/one-port/srt-demux.md) already plans. + The driver sees every inbound packet, so a connection that closes without + a valid Shutdown control packet from the peer is a failure. It also takes + `now` as input, which the mocked-clock tests need: srt-tokio reads std's + clock directly, so `tokio::time::pause` cannot drive its idle timeout. + +Open: which route, and whether this stays in m1 or moves under the m2 +driver. + +Tests either way, with a mocked clock: a silent peer aborts, a clean +shutdown finishes, in both the server and the `Client` pull +(`serve_publish`). Public API: none. Wire: none. From d21bc6c7b91d10e56c0ed3084afbb9f9f184f0aa Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 24 Oct 2026 12:34:22 -0700 Subject: [PATCH 3/3] quest: fold srt-end into the m2 srt-protocol driver Co-Authored-By: Claude Opus 5.5 --- quest/m1/broadcast-lifecycle/README.md | 3 +- quest/m1/broadcast-lifecycle/srt-end.md | 47 ------------------------- quest/m2/one-port/srt-demux.md | 13 ++++++- 3 files changed, 14 insertions(+), 49 deletions(-) delete mode 100644 quest/m1/broadcast-lifecycle/srt-end.md diff --git a/quest/m1/broadcast-lifecycle/README.md b/quest/m1/broadcast-lifecycle/README.md index 04554384a88..74c505b99a5 100644 --- a/quest/m1/broadcast-lifecycle/README.md +++ b/quest/m1/broadcast-lifecycle/README.md @@ -48,11 +48,12 @@ timer on main at 1582fdc07d: - [Stateless broadcasts](/quest/m1/broadcast-lifecycle/stateless.md) - `Finish`, its linger, and finished-only supersession are gone from moq-net, `@moq/net`, moq-ffi, moq-c, and every binding - [TS export follows by cause](/quest/m1/broadcast-lifecycle/ts-follow.md) - `export ts|srt --linger` becomes `--follow `, a replacement's catalog has no separate deadline, and a track failure is classified by its cause instead of a 1s grace -- [SRT tells a clean end from a failure](/quest/m1/broadcast-lifecycle/srt-end.md) - an SRT ingest whose peer goes silent aborts instead of finishing as if it had shut down - [Timer cleanups](/quest/m1/broadcast-lifecycle/timers.md) - `ConnectionProps.linger` is gone and stale linger references are fixed ## Related +- [SRT on the shared socket](/quest/m2/one-port/srt-demux.md) - an SRT ingest whose peer goes silent aborts instead of finishing as if it had shut down + - [moq-transport finish interop](/quest/m2/ietf-finish.md) - the interop `finish` case, whose late readers rely on retention - [CLI and gst flags](https://github.com/moq-dev/moq/pull/6522) - removed the opt-in `linger` booleans, leaving completion to this epic - [Publication owner](/quest/m1/api-audit/announce-owner.md) - adds `origin::Publication`; it must not forward a `finish` this epic deletes diff --git a/quest/m1/broadcast-lifecycle/srt-end.md b/quest/m1/broadcast-lifecycle/srt-end.md deleted file mode 100644 index c633f4cc6eb..00000000000 --- a/quest/m1/broadcast-lifecycle/srt-end.md +++ /dev/null @@ -1,47 +0,0 @@ -# [S] SRT tells a clean end from a failure - -## Goal - -An SRT ingest whose peer stops sending without a shutdown handshake ends its -broadcast with an error, while a peer that shuts down cleanly finishes it. -Today both finish (`rs/moq-srt/src/server.rs`, the `Ok(())` arm after the -socket stream ends), because srt-tokio ends the stream the same way for both. - -## Plan - -Decided with the maintainer on 2026-10-23: fix it at the source. - -Found on 2026-10-24: srt-tokio 0.4.4 (latest, and upstream `main`) cannot -tell them apart. `SrtSocket`'s stream never yields `Err`; its task returns -`()`. In srt-protocol, a peer Shutdown packet, the peer idle timeout, -and a UDP or listener channel error all move the receiver to `Drain` and then -`Closed`, and the private `ConnectionStatus` keeps no cause. The task then -closes the data channel, so moq-srt sees `None` for all three. Statistics -carry no shutdown counter and stop updating at close. - -What would fix it, by owner: - -- Upstream: srt-protocol records why the receiver left `Open` (peer shutdown, - idle timeout, socket closed, local close) and exposes it on - `DuplexConnection`. srt-tokio then yields `Err` (`TimedOut` or - `ConnectionAborted`) before `None` for any cause other than a peer - shutdown or local close. The stream item is already `io::Result`, so no - type changes; moq-srt's `try_next()?` would take the abort arm untouched. - Upstream is unmaintained (see - [SRT on the shared socket](/quest/m2/one-port/srt-demux.md)), and it is - outside the moq-dev and kixelated orgs: ask before posting there. -- In moq-srt: drive sans-io srt-protocol directly, as - [SRT on the shared socket](/quest/m2/one-port/srt-demux.md) already plans. - The driver sees every inbound packet, so a connection that closes without - a valid Shutdown control packet from the peer is a failure. It also takes - `now` as input, which the mocked-clock tests need: srt-tokio reads std's - clock directly, so `tokio::time::pause` cannot drive its idle timeout. - -Open: which route, and whether this stays in m1 or moves under the m2 -driver. - -Tests either way, with a mocked clock: a silent peer aborts, a clean -shutdown finishes, in both the server and the `Client` pull -(`serve_publish`). - -Public API: none. Wire: none. diff --git a/quest/m2/one-port/srt-demux.md b/quest/m2/one-port/srt-demux.md index 72b07c5a0ce..645641f02eb 100644 --- a/quest/m2/one-port/srt-demux.md +++ b/quest/m2/one-port/srt-demux.md @@ -4,7 +4,8 @@ `moq-srt` serves from the demuxed UDP socket beside QUIC, so an SRT encoder dials the relay's one port and the flow table pins its 4-tuple after the -induction handshake. +induction handshake. An SRT ingest whose peer goes silent aborts its +broadcast instead of finishing it as if the peer had shut down. ## Plan @@ -29,6 +30,16 @@ test vector from a real encoder, a vector that an RTP PT0 packet is not induction, and a test that floods provisional entries without evicting an established one. +The driver also tells a clean end from a failure, in both the server and +the `Client` pull (`serve_publish`): a close without a valid peer Shutdown +control packet aborts the broadcast, and a clean shutdown finishes it. +Decided 2026-10-24 to land it here rather than in m1: srt-tokio 0.4.4 ends +its stream with `None` for a peer Shutdown, the peer idle timeout, and a +socket error alike, and srt-protocol keeps no close cause, so only a driver +that sees every inbound packet can tell. Test both with a mocked clock, +which the driver allows by taking `now` as input; srt-tokio reads std's +clock, so `tokio::time::pause` cannot drive its idle timeout. + Tests: `moq-srt`'s existing integration test runs against the shared socket with a QUIC client active on the same port; a QUIC short header from a new 4-tuple during an SRT session still reaches QUIC.