diff --git a/quest/m2/README.md b/quest/m2/README.md index 2c1512d6214..85a5066a820 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -127,7 +127,6 @@ ranked just below deterministic TS legs, which it requires. - [Browser media report](/quest/m2/rs2ts-browser-report.md) - compare Rust-backed and handwritten @moq/net through full media workloads, supplementing the pre-adoption comparisons - [mTLS on tls://](/quest/m2/tls-listener-mtls.md) - a `tls://` listener can identify a cluster peer by its client certificate - [Link quality](/quest/m2/link-quality.md) - a radio link's cost follows its measured quality without flapping routes -- [One transport adapter](/quest/m2/transport-adapter-dedup.md) - the poll transport adapter exists once, and the 64 KiB cap in moq-net's default `poll_read_buf` (not in the adapter) has a test - [Archive recovery listing](/quest/m2/archive-recovery-listing.md) - a resumed DVR lists what changed since its checkpoint, not every stored group - [IETF on the ring](/quest/m2/uring-ietf.md) - the io_uring workers serve moq-transport sessions too, so a uring relay drops no client protocol - [One connection lifecycle](/quest/m2/uring-connection-log.md) - every accept path, io_uring included, logs a connection's span and close from one owner, so Interop's accounting works on the ring diff --git a/quest/m2/transport-adapter-dedup.md b/quest/m2/transport-adapter-dedup.md deleted file mode 100644 index 48f440b6244..00000000000 --- a/quest/m2/transport-adapter-dedup.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] One copy of the poll transport adapter - -## Goal - -The poll transport adapter exists once. #4709 copied the same -~310-line adapter into `rs/moq-ffi`, `rs/moq-uring` and `rs/moq-wasm` -(`src/transport/adapter.rs`), and moq-tokio repeats its error and stats -wrappers. The 64 KiB cap on moq-net's default `poll_read_buf` has a unit test. - -## Plan - -Start from the adapter #4709 landed. The transport-seam quest ruled out a new shared adapter crate. -Revisit that here: share one copy from an existing crate (for example moq-net behind a -feature, or one backend re-exporting it to the others), or record why the -copies stay. Add the `poll_read_buf` cap test either way. - -Decided 2026-10-08: backend-specific `moq-quic` methods (`poll_acked`, -`set_deadline`, `set_limits`) stay out of the shared generic adapter; moq-tokio -and moq-uring keep their own adapter code for those. The shared copy covers -only what every backend implements the same way, so a QUIC-only seam never -forces a default onto the browser, wasm, or FFI backends. - -Public API: possibly a feature-gated module. Wire: none. - -## Related - -- [poll_acked on moq-net's send stream](/quest/m2/quic-ack-hook.md) - a backend-specific method the moq-tokio and moq-uring adapters keep -- [Per-stream deadlines](/quest/m2/quic-deadline.md) - adds `set_deadline`, also kept out of the shared adapter -- [QUIC caps](/quest/m2/rate-quic.md) - extends `set_limits` with the bitrate caps diff --git a/rs/moq-net/src/transport.rs b/rs/moq-net/src/transport.rs index 8cf1ce6f551..6d0375e9203 100644 --- a/rs/moq-net/src/transport.rs +++ b/rs/moq-net/src/transport.rs @@ -712,4 +712,42 @@ mod tests { Poll::Ready(Ok(Some(0))) )); } + + #[test] + fn default_read_buf_caps_the_initialized_slice_on_ready_and_pending() { + struct ReadSpan(bool); + impl super::poll::RecvStream for ReadSpan { + type Error = crate::Error; + fn poll_read(&mut self, _: &mut Context<'_>, dst: &mut [u8]) -> Poll, Self::Error>> { + assert_eq!( + dst.len(), + 64 * 1024, + "one poll must not initialize the whole spare capacity" + ); + assert!(dst.iter().all(|byte| *byte == 0)); + if self.0 { + return Poll::Pending; + } + dst.fill(7); + Poll::Ready(Ok(Some(dst.len()))) + } + fn stop(&mut self, _: u32) {} + fn poll_closed(&mut self, _: &mut Context<'_>) -> Poll> { + Poll::Pending + } + } + for pending in [false, true] { + let mut buf = BytesMut::with_capacity(256 * 1024); + let mut cx = Context::from_waker(std::task::Waker::noop()); + let result = ReadSpan(pending).poll_read_buf(&mut cx, &mut buf); + if pending { + assert!(result.is_pending()); + assert!(buf.is_empty()); + } else { + assert!(matches!(result, Poll::Ready(Ok(Some(65536))))); + assert_eq!(buf.len(), 64 * 1024); + assert!(buf.iter().all(|byte| *byte == 7)); + } + } + } }