Repository navigation
quest: plan the WebSocket follow-ups from #426 #429
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,11 @@ | ||
| # [S] Bound a WebSocket QMux handshake | ||
|
|
||
| ## Goal | ||
|
|
||
| A QMux session over WebSocket closes with an error when the peer never sends TRANSPORT_PARAMETERS within `Config::handshake_timeout`, for `ws::Client`, `ws::Server` and `ws::Upgraded` alike. Today a peer that completes the WebSocket upgrade and then stays silent holds the session open indefinitely. | ||
|
|
||
| ## Plan | ||
|
|
||
| `Session::connect` and `Session::accept` bound the parameter exchange, but every ws builder starts through `Session::new`, which never waits for the peer's parameters. Arm the deadline inside the session started by `Session::new` and close the session with the same error `Session::connect` returns on timeout if the peer's TRANSPORT_PARAMETERS haven't arrived by then. This is the lowest layer that covers all three builders without an API change. Do not make `ws::Upgraded::connect`/`accept` async; that would break the API. Wire formats that exchange no transport parameters arm no deadline. Fold `Session::connect`/`accept`'s own timeout into the same mechanism if that simplifies things. | ||
|
|
||
| Remove the "`handshake_timeout` does not apply" notes from the three `with_session_config` docs. Cover each builder on paused time. Main only; backport to `qmux-v0.5.x` only if moq asks. |
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,11 @@ | ||
| # [S] Advertise a record size the WebSocket accepts | ||
|
|
||
| ## Goal | ||
|
|
||
| `ws::Client` and `ws::Server` never advertise a `max_record_size` larger than their WebSocket will accept, so a peer that sends a record within the advertised limit can't trip tungstenite's frame limit and kill the session. | ||
|
|
||
| ## Plan | ||
|
|
||
| Each QMux record is one WebSocket message, so tungstenite's `max_frame_size`/`max_message_size` (16 MiB frame by default) caps the usable record size. Give `ws::Server` a `with_config(WebSocketConfig)` matching `ws::Client`'s and pass it to `accept_hdr_async_with_config`. Both builders then advertise `min(max_record_size, the WebSocket's limit)`; the datagram limit already derives from the record size. Clamping keeps the advertised ceiling truthful without failing a connect. The one exception is a WebSocket limit below the QMux minimum (`DEFAULT_MAX_RECORD_SIZE`): the peer rejects that as a TRANSPORT_PARAMETER error, so `connect`/`accept` return an error locally instead of advertising it. | ||
|
|
||
| `ws::Upgraded` wraps any tungstenite `Sink`/`Stream`, so qmux can't see its limit; keep its `with_session_config` note telling callers to stay within it. Update the Client and Server docs to describe the clamp. Main only; backport to `qmux-v0.5.x` only if moq asks. | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: moq-dev/web-transport
Length of output: 33563
🏁 Script executed:
Repository: moq-dev/web-transport
Length of output: 44329
🏁 Script executed:
Repository: moq-dev/web-transport
Length of output: 28430
Validate the local size before advertising it.
The plan clamps the advertised value, but it does not define a local check for a clamped value below
DEFAULT_MAX_RECORD_SIZE. In that case, QMux can send the invalid transport parameter and let the peer reject it. Update the exception to require local rejection in both builders before sending QMux transport parameters.Suggested proposal update
📝 Committable suggestion
🤖 Prompt for AI Agents