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
7 changes: 7 additions & 0 deletions doc/concept/moq-lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ anything on its own. Both ends apply it: the publisher skips a group rather
than sending it, and the subscriber skips it again as it reads, since the
publisher only ever sees the most tolerant budget across its subscribers.

Across a native route failover, the reader still judges buffered groups against
the logical track's live edge, including groups it is draining from a retired
route. A successor group with no timestamp leaves the preceding group's reach
unbounded until its first frame arrives; if it is dropped first, the next group
takes its place. A cached open group's prefix remains
readable across repeated takeovers and idle resumes.

The publisher declares a retention window per track, which bounds how far back
a fetch or late subscriber can reach. Media tracks default to 30 seconds so a
segmented egress can still find its segments.
Expand Down
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ transport, benchmark tooling); worktrees isolate commits, not semantics.
- [WebTransport close upstream](/quest/m1/wt-close-upstream.md) - web-transport-moq delivers the close capsule itself, and moq-tokio's `CLOSE_LINGER` is deleted
- [IETF hidden default](/quest/m1/ietf-hidden-default.md) - a moq-transport peer without the MoQ Hidden option is advertised hidden namespaces; one with it filters per subscription
- [Watch refusal](/quest/m1/watch-refusal.md) - `<moq-watch>` shows an origin refusal as an error instead of sitting offline
- [Splice edge cases](/quest/m1/splice-edges.md) - an unstamped successor, a pruned segment's boundary group, and a warm head during a takeover are each handled correctly
- [Resumed groups](/quest/m1/resume-latest.md) - a half-delivered group ends once the new copy is past it, so a group-only reader never parks after a mid-group failover
- [Track tail hardening](/quest/m1/track-tail-hardening.md) - Rust and JS wait out a track's tail by the same rules, with the known hang, count, truncation, grace, and memory holes closed
- [JS close end](/quest/m1/js-track-close-end.md) - a JS track's clean close ends at its own last group, not a sibling producer's
Expand Down
1 change: 0 additions & 1 deletion quest/m1/resume-latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ Regression tests, on a paused clock (`#[tokio::test(start_paused = true)]`):
## Related

- [SUBSCRIBE_DROP](/quest/m1/subscribe-drop.md) - tells a resumed latest group when the new copy dropped it
- [Splice edge cases](/quest/m1/splice-edges.md) - the same splice code and test harness
37 changes: 0 additions & 37 deletions quest/m1/splice-edges.md

This file was deleted.

89 changes: 88 additions & 1 deletion rs/moq-net/src/model/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,9 @@ async fn run_front(task: FrontTask) {
tracks.remove(&name);
continue;
}
io.head = io.warm.take().and_then(|mut warm| warm.edge.take());
if let Some(head) = io.warm.take().and_then(|mut warm| warm.edge.take()) {
io.head = Some(head);
}
// The new segment has produced nothing yet: this is the
// edge the copy is asked to advance.
io.edge = io.resume.resume_position();
Expand Down Expand Up @@ -5703,6 +5705,91 @@ mod tests {
}
}

#[tokio::test]
async fn warm_head_survives_another_takeover_before_park() {
tokio::time::pause();
let producer = origin(1).produce();
let _server = producer
.dynamic("room/alice", Route::default().with_hops(hops(&[10])).with_cost(5))
.unwrap();
let pending = producer.consume().request_broadcast("room/alice");
let upstream = broadcast::Info::new().produce();
let mut dynamic = upstream.dynamic();
queued(&_server).await.accept(&upstream);
let resolved = pending.await.unwrap();

let track = resolved.track("log").unwrap();
let subscribing = tokio::spawn(async move { track.subscribe(None).await });
let source = dynamic.requested_track().await.unwrap().accept(None);
let mut group = source.create_group(0u64.into()).unwrap();
group.write_frame(crate::Timestamp::ZERO, b"a".as_ref()).unwrap();
group.write_frame(crate::Timestamp::ZERO, b"b".as_ref()).unwrap();
let mut subscription = subscribing.await.unwrap().unwrap();
let mut reading = subscription.recv_group().await.unwrap().unwrap();
assert_eq!(&reading.read_frame().await.unwrap().unwrap().payload[..], b"a");
drop(reading);
drop(subscription);
source.unused().await.unwrap();
drop(group);
drop(source);

let track = resolved.track("log").unwrap();
let subscribing = tokio::spawn(async move { track.subscribe(None).await });
let mut resumed = dynamic.requested_track().await.unwrap().resolving_start().accept(None);
resumed.start_at(0).unwrap();
let mut subscription = subscribing.await.unwrap().unwrap();
let mut reading = subscription.recv_group().await.unwrap().unwrap();
assert_eq!(&reading.read_frame().await.unwrap().unwrap().payload[..], b"a");

let replacement_server = producer
.dynamic("room/alice", Route::default().with_hops(hops(&[10])))
.unwrap();
let replacement = broadcast::Info::new().produce();
let mut replacement_dynamic = replacement.dynamic();
queued(&replacement_server).await.accept(&replacement);
let mut source = replacement_dynamic
.requested_track()
.await
.unwrap()
.resolving_start()
.accept(None);
source.start_at(0).unwrap();
let mut group = source.create_group(0u64.into()).unwrap();
group.start_at(2).unwrap();
group.write_frame(crate::Timestamp::ZERO, b"c".as_ref()).unwrap();
let mut continuation = reading.clone();
continuation.start_at(2);
let frame = tokio::time::timeout(Duration::from_secs(1), continuation.read_frame())
.await
.expect("replacement frame")
.unwrap()
.unwrap();
assert_eq!(&frame.payload[..], b"c");
drop(continuation);
assert_eq!(&reading.read_frame().await.unwrap().unwrap().payload[..], b"b");
assert_eq!(&reading.read_frame().await.unwrap().unwrap().payload[..], b"c");
drop(reading);
drop(subscription);
source.unused().await.unwrap();
drop(group);
drop(source);

let track = resolved.track("log").unwrap();
let subscribing = tokio::spawn(async move { track.subscribe(None).await });
let mut next = replacement_dynamic
.requested_track()
.await
.unwrap()
.resolving_start()
.accept(None);
next.start_at(0).unwrap();
let mut subscription = subscribing.await.unwrap().unwrap();
let mut reading = subscription.recv_group().await.unwrap().unwrap();
for expected in [b"a", b"b", b"c"] {
assert_eq!(&reading.read_frame().await.unwrap().unwrap().payload[..], expected);
}
}

/// The same holds for a reader returning to a parked track: its warm cache
/// does not stand in for the copy it is waiting on.
#[tokio::test]
Expand Down
Loading
Loading