Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/lib/rs/moq-net.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ What you use it for, beyond what the concept page already describes:
- **Demand says whether anyone is watching.** `demand()` on a track, group, or broadcast says whether a subscriber is attached. First-party capture does not wait for it: video encodes while enabled and audio keeps raw PCM to encode when someone listens, so a late subscription's `delay.max` or a FETCH finds the recent past. Demand gates bandwidth reservations, transcode rungs, and on-demand video where a publisher opts in, which saves the encode but leaves nothing from before the first subscriber. Holding a broadcast or track consumer is not demand: a track consumer requests nothing until it queries, subscribes, or fetches, and those count until dropped. A shared fetch stays up until its last reader leaves. Demand rolls up: a frame being read keeps its group wanted, a group a subscription or fetch handed out keeps its track wanted until read to its end, and any wanted track keeps its broadcast wanted.
- **Use the model without a runtime.** By default `moq-net` is its `poll_*` APIs and origin driver with caller-supplied time. The `async` feature adds their async wrappers, `time::run`, and both wire sessions.
- **You drive the session, or `moq-tokio` does.** `connect` and `accept` return a session plus a driver that never reads the clock itself. `moq_net::time::run` polls it on tokio. `moq-tokio` hides that. A custom transport implements `moq_net::transport::poll`, and `moq_net::transport::memory::pair` links two sessions in one process with no sockets, for tests or in-process links.
- **Reconnect policy comes with it.** With the `async` feature, `moq_net::Reconnect` decides which of a peer's addresses to dial, how long each dial and handshake may take, when to back off and give up, and how to follow a GOAWAY, without doing I/O: you dial each `Attempt` it asks for and report back. `moq-tokio`'s `Connection` runs it, so a client on another runtime gets the same policy rather than a copy.
- **A session bounds what its peer can hold.** Each request holds a stream, so the transport's stream credit bounds subscriptions and FETCHes. `session::Limits` (via `Client::with_limits` and `Server::with_limits`) bounds the announcements per session. The default suits a relay mesh, so lower it for untrusted peers. Past it, the session closes with `TOO_MANY_REQUESTS`. Peer-declared lengths are capped before they are buffered.
- **Authorization is in band.** On moq-lite 07 (`moq-lite-07-wip`, opt-in) and on moq-transport draft-18+ with the [MoQ Auth extension](/draft/moq-auth), `session.auth()` presents tokens without reconnecting and watches the grant the peer sent back. `add(token)` resolves with the token and how the peer took it: `Answer::Granted` on its AUTH stream, or `Answer::Requests` on moq-transport without AUTH, where only a request that names it carries it. A handle passed to `Client::with_auth` outlives each session, so its tokens, and the routes naming them, carry across your own reconnects. A server verifies tokens itself by taking `handshake.requests()` before `ok()`. `authorize(&grant)` narrows or widens a live session on any version: what falls outside resets with `Unauthorized` and the session stays up. A client that publishes outside its grant closes the session, naming the path.
- **A graceful close waits.** `session.close().await` withdraws announcements and drains for up to one second. `moq-lite-05` and newer wait for the subscriber to receive finished tails; older Lite versions and IETF wait only for transport ACKs. `abort` ends immediately.
Expand Down
11 changes: 9 additions & 2 deletions quest/m0/test-flakes-2/ffi-datagram-roundtrip.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ Investigation 2026-11-05 on `main` at `419b799c75`:
[moq-dev/moq#7951](https://github.com/moq-dev/moq/pull/7951) is real,
but was not reproduced by these tests. Do not claim it caused this timeout.
- `datagrams_cross_a_default_connection` is disabled pending diagnosis, per
the repository's flaky-test rule. Its requested siblings have not failed
in this investigation and remain enabled. No retry or longer wait was added.
the repository's flaky-test rule. No retry or longer wait was added.
- `requested_datagrams_cross_a_default_connection` is quarantined too, by
[moq-dev/moq#7904](https://github.com/moq-dev/moq/pull/7904): its single
datagram missed the 10 s wait in that PR's
[Check](https://github.com/moq-dev/moq/actions/runs/42076855917/job/127419261608)
(panic at `rs/moq-ffi/src/test.rs:6111`), the same symptom as the plain
test, then passed 100 of 100 stress runs on an idle host. Re-enable it with
the plain test once this quest's cause is fixed; its other requested
siblings stay enabled.

## Waiting

Expand Down
1 change: 0 additions & 1 deletion quest/m1/session-policy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ Research (2026-11-04, `origin/main` at e6be13d5f8):
## Required

- [Accept policy in moq-net](/quest/m1/session-policy/accept.md) - one accept deadline, admission bound and window widening for every transport
- [Connect policy in moq-net](/quest/m1/session-policy/connect.md) - the connect deadline and reconnect as a poll machine
- [The io_uring relay path uses moq-net's policy](/quest/m1/session-policy/uring.md) - deletes `uring.rs`'s copy
- [moq-tokio becomes a thin shell](/quest/m1/session-policy/tokio-handoff.md) - sockets, TLS, accept loops and spawning, plus the transport handoffs WebRTC needs
32 changes: 0 additions & 32 deletions quest/m1/session-policy/connect.md

This file was deleted.

1 change: 0 additions & 1 deletion quest/m1/session-policy/tokio-handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ it re-exported, with MIGRATE notes. Wire: none.
## Required

- [Accept policy in moq-net](/quest/m1/session-policy/accept.md) - the accept policy the handoff runs
- [Connect policy in moq-net](/quest/m1/session-policy/connect.md) - the connect policy the handoff runs
1 change: 0 additions & 1 deletion quest/m2/recut-held.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ padding probes in [lite07-finalize](/quest/m2/lite07-finalize.md).

- [IETF datagram tracks](/quest/m1/datagram-tracks/ietf.md) - claim held datagram-tracks
- [rind CPU error](/quest/m1/rind/cpu-error.md) - claim held rind
- [Connect policy](/quest/m1/session-policy/connect.md) - claim held session-policy
- [Release on leave](/quest/m1/stream-credit/release-on-leave.md) - claim held stream-credit
- [Probe padding](/quest/m2/probe/padding.md) - claim held probe
5 changes: 3 additions & 2 deletions quest/m5/uring-cluster-dial.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ lands only if the measurement shows a win.
serves inbound traffic, so a ring relay forwards its cluster media through
tokio. A port needs the ring client to grow what `moq-tokio` provides:
DNS and address racing, reconnect, and fingerprint pinning (the raw ring
client takes one `SocketAddr`). Share that policy with `moq-tokio` rather
than duplicate it.
client takes one `SocketAddr`). The reconnect half already lives in
moq-net as `moq_net::Reconnect`, which a ring client drives with its own
dials; share the rest with `moq-tokio` rather than duplicate it.

Measure first with a prototype dialing a fixed address from a worker:
CPU per Gbps and latency on the relay-to-relay fanout shape, ring against
Expand Down
17 changes: 8 additions & 9 deletions rs/moq-ffi/src/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,12 @@ mod read_tests {

/// A catalog rendition's warmup survives conversion, widens the raw subscription past the
/// caller's max delay, keeping the min delay as asked, and starts the reader that much further
/// back: with newest-first delivery it waits for a group covering the min delay plus the warmup.
#[tokio::test(start_paused = true)]
/// back.
///
/// Reads no clock: the reader polls on the FFI runtime, whose clock is not a paused test
/// runtime's, so a wait for the reach would measure real time. moq-mux's start-reach tests
/// cover that wait on one clock.
#[tokio::test]
async fn raw_media_catalog_warmup_reaches_the_subscription() {
use crate::consumer::{MoqDelay, MoqSubscription, moq_subscription_defaults};

Expand Down Expand Up @@ -1616,15 +1620,10 @@ mod read_tests {
.unwrap();
group.finish().unwrap();
};
// Newest first: group 4 covers the min delay alone, but not the warmup too.
// Newest first, all before the first read. Group 4 covers the min delay alone, so
// without the warmup the start would skip group 3; only the warmup's reach keeps it.
write(5, 5_000_000);
write(4, 4_700_000);
assert!(
kio::clock::timeout(Duration::from_millis(50), reader.next())
.await
.is_err(),
"video={video}: the start waits for a group covering the warmup"
);
write(3, 4_400_000);
track.finish().unwrap();
let mut micros = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions rs/moq-ffi/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6029,6 +6029,7 @@ async fn datagrams_cross_a_default_connection() {
/// An on-demand datagram-only track reaches a reader on the default lite-06 path while a
/// stream handler leaves the name unanswered: the datagram handler's answer serves it.
#[tokio::test]
#[ignore = "flaky under CI load; tracked in quest/m0/test-flakes-2/ffi-datagram-roundtrip.md"]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
async fn requested_datagrams_cross_a_default_connection() {
requested_datagrams_cross(vec![], "moq-lite-06").await;
}
Expand Down
4 changes: 4 additions & 0 deletions rs/moq-net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ mod test_interop;
mod util;
mod version;

#[cfg(feature = "async")]
pub mod reconnect;
#[cfg(feature = "async")]
pub mod server;
#[cfg(feature = "async")]
Expand All @@ -150,6 +152,8 @@ pub use instance::{Instance, InvalidInstance};
pub use model::*;
pub use path::{InvalidPattern, Path, Pattern, Patterns};
#[cfg(feature = "async")]
pub use reconnect::Reconnect;
#[cfg(feature = "async")]
pub use server::Server;
#[cfg(feature = "async")]
pub use session::Session;
Expand Down
Loading
Loading