Repository navigation
quest(m1): plan MoQT own-range codes and relay drain from web accept #5374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # [S] A relay drain counts web connections from accept | ||
|
|
||
| ## Goal | ||
|
|
||
| A relay drain never exits under an HTTP/1.1 WebSocket client that is still | ||
| in TLS or HTTP header parsing. HTTP/1.1 web connections hold the drain from | ||
| TCP accept until their first request shows they are not a WebSocket upgrade. | ||
| h2 connections release at ALPN, since h2 can't carry a WebSocket today. | ||
|
|
||
| ## Plan | ||
|
|
||
| `serve_ws` (`rs/moq-relay/src/websocket.rs`) takes `activity.enter()` in the | ||
| axum handler, so a connection before that point isn't counted and | ||
| `Activity::close()` can see zero (the Codex follow-up on #5286). | ||
| `doc/bin/relay/config.md` already claims accepted connections hold the | ||
| drain, so it is wrong for this case today. | ||
|
|
||
| `listener/idle.rs` already sees accept, each request's headers and the | ||
| upgrade flag, and its deadline covers TLS. Hold the `Active` there and hand | ||
| it to `serve_ws` through a request extension. h2 extended CONNECT isn't | ||
| enabled, so an h2 connection releases its guard once ALPN picks h2. | ||
|
|
||
| Decided 2026-10-12: | ||
|
|
||
| - On HTTP/1.1, release at the first request's headers unless it is an | ||
| upgrade. A later upgrade on the same keep-alive connection is counted from | ||
| the handler only, as today. | ||
| - A connection that arrives after the drain commits (`enter()` returns | ||
| None) is accepted without a guard: `serve_ws` refuses the upgrade with 503 | ||
| as today, and plain HTTP is served until the listener stops. | ||
|
|
||
| Plain HTTP/1.1 on the public listeners (HLS, API, health checks) now holds the | ||
| drain from accept through its first request's headers, bounded by | ||
| `listen.timeout` and the drain deadline. Say so in `config.md`. The internal | ||
| listener doesn't use the web acceptor and is unaffected. | ||
|
|
||
| Tests (paused time): start the drain while one HTTP/1.1 client is mid-TLS or | ||
| mid-headers; `Relay::run` doesn't return until it upgrades and gets a | ||
| GOAWAY, or the deadline passes. A plain HTTP/1.1 GET releases the guard so the drain | ||
| exits. `Relay::with_web` (embedders) goes through the same acceptor. | ||
|
|
||
| Public API: none. Wire: none. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # [XS] MoQT never sends moq-lite's own session codes | ||
|
|
||
| ## Goal | ||
|
|
||
| An IETF (MoQT) session close never carries a moq-lite own-range code | ||
| (0x30-0x3f). An unmapped own-range `SessionError::Unknown` becomes an | ||
| unspecified error (0x1) on MoQT, as the moq-lite draft requires at a bridge. | ||
|
|
||
| ## Plan | ||
|
|
||
| Today Rust IETF closes pass `SessionError::Unknown(0x30..=0x3f)` through | ||
| unchanged: `Version::session_code` and the direct `to_code()` calls in | ||
| `ietf/session.rs` and `ietf/publisher.rs`. Stream resets are already safe, | ||
| since IETF `to_stream_code` maps unknown codes to INTERNAL_ERROR. The relay | ||
| never forwards one session's close code onto another, so this is latent and | ||
| reachable through `Session::abort(Error::Session(Unknown(0x3x)))`. | ||
|
|
||
| Decided 2026-10-12: map it in the IETF session-code encoder, mirroring | ||
| `lite::error::to_session_code`, and route `Version::session_code` and the | ||
| direct IETF close sites through it. Not in the shared | ||
| `SessionError::to_code`: moq-ffi and moq-c expose that value verbatim | ||
| (`from_session`), so a received Lite `Unknown(0x31)` would reach every | ||
| binding as 0x1. Lite keeps its own arm. Rust only: JS was checked and can't | ||
| emit these codes (`abort()` takes no code, IETF closes use fixed codes, and | ||
| auth rejections send UNAUTHORIZED or NOT_SUPPORTED). | ||
|
|
||
| Tests: an IETF close with `Unknown(0x31)` sends 0x1, a Lite close and | ||
| `to_code()` are unchanged, and `Unknown(0x20)` (the reserved range) still passes through on | ||
| both. | ||
|
|
||
| Public API: none; `SessionError::to_code` is unchanged. Wire: encoding and | ||
| negotiated versions are unchanged, but the close code value changes: a MoQT | ||
| close carrying `Unknown(0x30..=0x3f)` sends 0x1 instead of that code. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Malformed moq-lite input](/quest/m1/lite-malformed-close.md) - the neighbouring Lite close-code rules |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.