diff --git a/js/net/src/fill.test.ts b/js/net/src/fill.test.ts index 7e5212e38c5..e54020eda28 100644 --- a/js/net/src/fill.test.ts +++ b/js/net/src/fill.test.ts @@ -797,7 +797,7 @@ test("fill: a refusal under an old budget is asked afresh on each widening, neve const fill = await requests.requestedFill(); expect([fill?.start, fill?.end]).toEqual([0n, 5n]); if (!fill) throw new Error("no fill"); - rejectGroups(fill, 0n, 5n, old, budget); + rejectGroups(fill, 0n, 5n, old, { budget, everyone: false }); fill.close(); reader.update(terms(budget * 2)); } @@ -1261,3 +1261,62 @@ test("fill: a lite-07 ranged subscription reads history the publisher never cach peer.close(); } }); + +// A fill's OLD answer under the publisher's max age binds every reader, so the track holds it as +// a stale verdict under that age rather than a loss for good: the readers waiting now are refused, +// a later reader no wider is settled without asking, and once new terms forget the verdict a +// reader asks again. Mirrors the Rust `a_fills_old_answer_under_the_max_age_is_held_until_forgotten`. +test("fill: an OLD answer under the max age is held as stale until forgotten", async () => { + const broadcast = new BroadcastProducer(); + const track = broadcast.createTrack("video", { maxAge: Duration.millis(10_000) }); + const live = track.createGroup(3n); + live.writeFrame({ payload: enc.encode("live 3") }); + live.finish(); + const requests = track.requests(); + const terms: Subscription = { + ranges: [{ start: { absolute: 0n } }], + delay: { max: Duration.millis(60_000) }, + order: "ascending", + }; + const asked = async () => { + const fills: bigint[][] = []; + for (;;) { + const fill = await Promise.race([requests.requestedFill(), yieldNow().then(() => undefined)]); + if (!fill) return fills; + fills.push([fill.start, fill.end]); + fill.close(); + } + }; + const reader = track.subscribe(terms); + expect(reader.tryRecvGroup()?.sequence).toBe(3n); + reader.tryRecvGroup(); + // A reader of the run alone, which the verdict does not settle, waits on the same fill. + const bounded = track.subscribe({ ...terms, ranges: [{ start: { absolute: 0n }, end: { absolute: 3n } }] }); + bounded.tryRecvGroup(); + const fill = await requests.requestedFill(); + if (!fill) throw new Error("no fill"); + expect([fill.start, fill.end]).toEqual([0n, 3n]); + const old = new StreamError(StreamCode.Old, { message: "old" }); + rejectGroups(fill, 0n, 3n, old, { budget: 10_000, everyone: true }); + expect(hooks.tryDrop(bounded)).toMatchObject({ kind: "drop", start: 0n, end: 3n, error: old }); + fill.close(); + + const later = track.subscribe(terms); + expect(later.tryRecvGroup()?.sequence).toBe(3n); + later.tryRecvGroup(); + expect(hooks.tryDrop(later)).toMatchObject({ kind: "drop", start: 0n, end: 3n, stale: 10_000 }); + expect(await asked()).toEqual([]); + + expect(hooks.supersedeStale(track, undefined)).toEqual([{ start: 0n, end: 3n }]); + const again = track.subscribe(terms); + expect(again.tryRecvGroup()?.sequence).toBe(3n); + again.tryRecvGroup(); + expect(await asked()).toEqual([[0n, 3n]]); + + reader.close(); + bounded.close(); + later.close(); + again.close(); + requests.close(); + broadcast.close(); +}); diff --git a/js/net/src/fill.ts b/js/net/src/fill.ts index 87c040a4404..85fcb971f98 100644 --- a/js/net/src/fill.ts +++ b/js/net/src/fill.ts @@ -32,8 +32,11 @@ export interface FillTrack { readonly name: string; /** Insert group `sequence` into the cache, committing `info` first if the track has none. */ accept(sequence: bigint, info: Info | undefined): GroupProducer; - /** Record `[start, end)` as never to be delivered. */ - drop(start: bigint, end: bigint, error: Error): void; + /** + * Record `[start, end)` as never to be delivered, with `error`. With `stale`, judged too old + * under that budget in milliseconds: a verdict only on readers no more tolerant. + */ + drop(start: bigint, end: bigint, hole: { error: Error; stale?: number }): void; /** Whether the track still caches group `sequence`, not failed. */ holds(sequence: bigint): boolean; /** Whether the track closed, so nothing more can be served. */ @@ -67,7 +70,7 @@ export interface Asker { // The fill operations a handle runs against the state it came from; assigned in its static block. let fillOps: { accept(state: FillState, pending: Pending, sequence: bigint, info: Info | undefined): GroupProducer; - drop(state: FillState, pending: Pending, start: bigint, end: bigint, error?: Error): void; + drop(state: FillState, pending: Pending, start: bigint, end: bigint, hole?: { error: Error; stale?: number }): void; refuse(state: FillState, pending: Pending, start: bigint, end: bigint, error: Error, stale?: number): void; settle(state: FillState, pending: Pending): void; name(state: FillState): string; @@ -283,7 +286,8 @@ export class FillState { // Answer what `pending` still owes as dropped, then forget it. #settle(pending: Pending): void { - for (const run of pending.owed()) this.#track.drop(run.start, run.end, new NotFound(`group ${run.start}`)); + for (const run of pending.owed()) + this.#track.drop(run.start, run.end, { error: new NotFound(`group ${run.start}`) }); this.#finish(pending); } @@ -315,11 +319,15 @@ export class FillState { // Landing in the cache answers it, as `arrived` records. return state.#track.accept(sequence, info); }, - drop: (state, pending, start, end, error) => { + drop: (state, pending, start, end, hole) => { for (const run of pending.owed(start, end)) { - state.#track.drop(run.start, run.end, error ?? new NotFound(`group ${run.start}`)); + state.#track.drop(run.start, run.end, hole ?? { error: new NotFound(`group ${run.start}`) }); } - state.#resolve(pending, start, end); + // A stale verdict settles only readers that read every group above it, so the readers + // waiting now are refused as well, as the Rust `Inner::drop_groups` does. It binds every + // reader, so the refusal carries no budget a wider one could see past. + if (hole?.stale !== undefined) fillOps.refuse(state, pending, start, end, hole.error); + else state.#resolve(pending, start, end); }, refuse: (state, pending, start, end, error, stale) => { for (const gap of pending.unresolved(start, end)) { @@ -348,16 +356,28 @@ function subtract(gap: Run, run: Run): Run[] { export let wantedRuns: (fill: Fill) => Run[]; /** Wait for a change to the groups or readers of a fill. @internal */ export let fillChanged: (fill: Fill) => Promise; +/** + * The budget in milliseconds an OLD answer was judged under, and whether that is the publisher's + * max age, which binds every reader, rather than the request's own budget. + * + * @internal + */ +export interface Judged { + budget: number; + everyone: boolean; +} + /** * Answer `[start, end)` of `fill` with its source's refusal of a request for them. An OLD one * says every older group of the fill is stale too, since a timed track's starts never rewind: - * with `stale`, the budget in milliseconds the request carried, it is refused to the readers - * waiting now, a verdict only on those no more tolerant, so a wider reader asks again; without, - * the publisher's max age judged it, which binds every reader, so the track records it dropped. - * Any other refusal answers only `[start, end)`, for now. Mirrors the Rust `Fill::reject_groups`. + * judged under the request's own budget, or a max age not known here (`judged` undefined), it is + * refused to the readers waiting now, a verdict only on those no more tolerant, so a wider reader + * asks again; under the publisher's max age it binds every reader, so the track records it as a + * stale verdict under that age, which new terms or the drop set's expiry window forget. Any other + * refusal answers only `[start, end)`, for now. Mirrors the Rust `Fill::reject_groups`. * @internal */ -export let rejectGroups: (fill: Fill, start: bigint, end: bigint, error: Error, stale: number | undefined) => void; +export let rejectGroups: (fill: Fill, start: bigint, end: bigint, error: Error, judged: Judged | undefined) => void; // Constructs the public handles from within this module; assigned in their static blocks. let makeFill: (state: FillState, pending: Pending) => Fill; @@ -465,13 +485,13 @@ export class Fill { makeFill = (state, pending) => new Fill(state, pending); wantedRuns = (fill) => fill.#pending.owed(); fillChanged = (fill) => Promise.resolve(fill.#pending.revision.changed()); - rejectGroups = (fill, start, end, error, stale) => { + rejectGroups = (fill, start, end, error, judged) => { if (toStreamCode(error) !== StreamCode.Old) { fill.refuseGroups(start, end, error); - } else if (stale === undefined) { - fillOps.drop(fill.#state, fill.#pending, fill.start, end, error); + } else if (judged?.everyone) { + fillOps.drop(fill.#state, fill.#pending, fill.start, end, { error, stale: judged.budget }); } else { - fillOps.refuse(fill.#state, fill.#pending, fill.start, end, error, stale); + fillOps.refuse(fill.#state, fill.#pending, fill.start, end, error, judged?.budget); } }; } diff --git a/js/net/src/lite/subscriber.ts b/js/net/src/lite/subscriber.ts index 808db75da13..a00704943a2 100644 --- a/js/net/src/lite/subscriber.ts +++ b/js/net/src/lite/subscriber.ts @@ -22,7 +22,7 @@ import { toStreamCode, unauthorized, } from "../error.ts"; -import { fillChanged, rejectGroups, wantedRuns } from "../fill.ts"; +import { fillChanged, type Judged, rejectGroups, wantedRuns } from "../fill.ts"; import * as netGroup from "../group.ts"; import { Cost, type Hop, MAX_HOPS, routesEqual, UNKNOWN_HOP, WireRoute } from "../hop.ts"; import * as Instance from "../instance.ts"; @@ -2542,10 +2542,10 @@ export class Subscriber { const { start, end } = resp.drop; entry.tail.account(start, end); const cause = resp.drop.cause(this.version); - // Only a group its publisher never had is lost for every reader, and asked with no - // budget, an OLD one is past the publisher's max age, which binds every reader too. + // Only a group its publisher never had is lost for every reader; anything else, + // OLD included, is refused for now, as the Rust `Refusal::answer` does. if (toStreamCode(cause) === StreamCode.NotFound) fill.dropGroups(start, end); - else rejectGroups(fill, start, end, cause, undefined); + else fill.refuseGroups(start, end, cause); } else if ("skip" in resp) { // Never produced: final, as the subscription feeding the copy records it. const { start, end } = resp.skip; @@ -2559,12 +2559,13 @@ export class Subscriber { } } - // The budget an OLD answer to a request carrying `asked` judged, or undefined when it - // reached the publisher's max age, which binds every reader, as the Rust - // `Inner::old_binds_everyone` judges. No budget leaves only the max age. - #stale(framing: Framing, asked: number | undefined): number | undefined { + // The budget an OLD answer to a request carrying `asked` judged: the publisher's max age once + // it reached it, which binds every reader, as the Rust `Inner::binding_max_age` judges. No + // budget leaves only the max age; undefined when neither is known. + #stale(framing: Framing, asked: number | undefined): Judged | undefined { const bound = framing.maxAge?.asMillis(); - return asked === undefined || (bound !== undefined && asked >= bound) ? undefined : asked; + if (asked !== undefined && (bound === undefined || asked < bound)) return { budget: asked, everyone: false }; + return bound === undefined ? undefined : { budget: bound, everyone: true }; } // Settle `[start, end)` of what `producer`'s subscription re-offers: a stream or a verdict diff --git a/js/net/src/track.ts b/js/net/src/track.ts index cbf920d49f0..622eb615bf6 100644 --- a/js/net/src/track.ts +++ b/js/net/src/track.ts @@ -1135,8 +1135,8 @@ export class Producer { if (info !== undefined && this.#state.info.peek() === undefined) this.accept(info); return this.#createGroup(sequence, 0, true); }, - drop: (start, end, error) => { - this.#drop(start, end, { error }); + drop: (start, end, hole) => { + this.#drop(start, end, hole); this.#chargeDebt(); }, holds: (sequence) => cachedHolds(this, sequence), diff --git a/quest/m1/group-error-cache.md b/quest/m1/group-error-cache.md deleted file mode 100644 index 8f9831c05c8..00000000000 --- a/quest/m1/group-error-cache.md +++ /dev/null @@ -1,83 +0,0 @@ -# [M] Group errors are cached by kind, retryable ones for a bounded time - -## Goal - -Every place moq-net records that a group won't be delivered, in Rust and -JS, follows one rule. A permanent error, where the group can never be -served, is recorded and binds every later reader. A retryable error is kept -only for a bounded time, so a later reader or a widened one asks again once -it lapses, while a burst of readers doesn't re-ask the source for each one. -Both paths that cache `Old` permanently on main follow the rule. - -## Plan - -Planned 2026-11-04 with the maintainer, while settling -[moq-dev/moq#7872](https://github.com/moq-dev/moq/pull/7872). In the -maintainer's words: "we should cache errors for some amount of time. I -really hate classifying them though, but I think we kind of have to know -the difference between permanent and retryable errors." Milestone m1 -(maintainer). - -Where this starts: #7872 (decision 2, 2026-11-04) made a range's own start -skip, a second stale drop, and history recovered once non-permanent. -`Fill::refuse_groups` records nothing, while `Fill::drop_groups` records -the groups as lost for good (`rs/moq-net/src/model/track/fill.rs`). The -only permanent losses it kept are a SUBSCRIBE_DROP NotFound and groups past -the track's end. Two paths on main still cache `Old` permanently, listed as -#7872's follow-ups: - -- A live SUBSCRIBE_DROP records every error on the track, `Old` included: - `self.serving.drop_groups(...)` in `rs/moq-net/src/lite/subscriber.rs` - (the `SubscribeResponse::Drop` arm), into `track::Producer::drop_groups` - (`rs/moq-net/src/model/track.rs`). -- `Fill::reject` for lite and IETF FETCH (`reject` in - `rs/moq-net/src/model/track/fill.rs`) records `Old` as dropped when - `old_binds_everyone`, that is when the publisher's max age applies to - every reader. - -The work: - -- **Inventory** every place a group error is recorded or refused, in Rust - (`TrackState::drop_groups`, `drop_unfed`, `Fill::drop_groups`, - `refuse_groups`, `reject_groups`, `reject`, the IETF subscriber's fetch - and range drops in `rs/moq-net/src/ietf/subscriber.rs`) and JS (`#drop` - in `js/net/src/track.ts`, `Fill.dropGroups` and `refuseGroups` in - `js/net/src/fill.ts`, and `js/net/src/ietf/range.ts`). For each, note - which errors reach it and whether it caches them. Put the inventory in the - PR. -- **The smallest classification that works.** Recommended starting point: - permanent for not found, past the track's end, and unauthorized; - retryable for old, lagged, evicted, cancelled, and unroutable. Keep it a - property of the error kind, decided in one place, rather than a per-call - choice. Prefer fewer classes if the inventory shows one is never needed. - Don't match on error variants at the call sites (AGENTS.md); classify - once where the error is defined. -- **Bounded caching for retryable errors.** Decide whether a retryable - error is cached at all, and for how long. Prefer a bound the track - already has over a new constant: for `Old`, the budget it was judged - under (a widening already re-asks), or the publisher's max age. The - bound must also hold up against a hostile peer: what the cache holds is - sized by the pool, as the drop set ([moq-dev/moq#8476](https://github.com/moq-dev/moq/pull/8476)) bills its - runs. -- **Fix both main paths** under the rule: a live SUBSCRIBE_DROP records - only a permanent error, and `Fill::reject` stops recording `Old` as lost - for good. Mirror both in JS. -- **To settle in this quest, with the maintainer:** the drop set keeps a - received stale run with the budget it was judged under, reversed only by a - widening ("Only a widening reverses a stale verdict"). That is a - retryable error held without a time bound. Either the bounded-time rule - covers those runs too, or the drop set's budget scoping already counts as - the bound for `Old`. Recommended: the latter, so `Old` has one bound (its - budget) and the time bound covers the other retryable kinds. -- Tests: a retryable refusal is asked again after its bound lapses and not - before; a permanent one never is; a live SUBSCRIBE_DROP with `Old` no - longer binds a wider reader; a FETCH answered `Old` under the publisher's - max age is asked again once the bound lapses. - -Public API: possibly a classification query on `Error` (Rust) and its JS -mirror, if a caller outside moq-net needs it; otherwise none. Wire: none. - - -## Related - -- [A group a subscriber gives up on is always reported](/quest/m2/group-drops.md) - reports what a subscriber gives up; this decides how long the track remembers it diff --git a/rs/moq-net/src/model/track.rs b/rs/moq-net/src/model/track.rs index ddd992be98b..c179fd5dcfd 100644 --- a/rs/moq-net/src/model/track.rs +++ b/rs/moq-net/src/model/track.rs @@ -23929,6 +23929,67 @@ mod test { assert!(matches!(dynamic.poll_requested_fill(&waiter), Poll::Ready(Ok(_)))); } + /// A fill's OLD answer under the publisher's max age binds every reader, so the track holds + /// it as a stale verdict under that age rather than a loss for good: the readers waiting now + /// are refused, a later reader no wider is settled without asking, and once the verdict is forgotten, as new terms or the + /// drop set's expiry window forget one, a reader asks again. Mirrors JS. + #[test] + #[cfg(feature = "async")] + #[expect(clippy::single_range_in_vec_init, reason = "the forgotten runs are a set, here one")] + fn a_fills_old_answer_under_the_max_age_is_held_until_forgotten() { + let max_age = Duration::from_secs(10); + let mut producer = track_producer("test", Info::timed().with_max_age(max_age)); + let dynamic = producer.requests(); + producer.start_at(3).unwrap(); + write_group(&producer, 3); + // No subscription feeds the copy, so nothing below the start arrives but what a fill does. + producer.set_unfed(true); + let terms = || { + Subscription::default() + .with_delay(Delay::default().with_max(Duration::from_secs(60))) + .with_ranges([Range::groups(0..)]) + }; + let mut subscriber = producer.subscribe(terms()); + let waiter = kio::Waiter::noop(); + assert_eq!(drain_groups(&mut subscriber), [3]); + // A reader of the run alone, which the verdict does not settle, waits on the same fill. + let mut bounded = producer.subscribe(terms().with_ranges([Range::groups(0..3)])); + assert!(drain_groups(&mut bounded).is_empty()); + let Poll::Ready(Ok(fill)) = dynamic.poll_requested_fill(&waiter) else { + panic!("a fill is asked below the start"); + }; + fill.reject_groups(0..3, Error::Old); + drop(fill); + assert_eq!(drained_drops(&mut subscriber), [(0, 3)]); + assert_eq!( + drained_drops(&mut bounded), + [(0, 3)], + "the readers waiting now are refused" + ); + assert!(dynamic.poll_requested_fill(&waiter).is_pending()); + assert_eq!( + producer.state.read().drops.get(&0), + Some(&Hole::stale(max_age)), + "held under the max age, which a widening reverses" + ); + + let mut later = producer.subscribe(terms()); + assert_eq!(drain_groups(&mut later), [3]); + assert_eq!(drained_drops(&mut later), [(0, 3)]); + assert!( + dynamic.poll_requested_fill(&waiter).is_pending(), + "the verdict is not asked again" + ); + + assert_eq!(producer.supersede_stale(None), RangeSet::from_iter([0..3])); + let mut again = producer.subscribe(terms()); + assert_eq!(drain_groups(&mut again), [3]); + assert!( + matches!(dynamic.poll_requested_fill(&waiter), Poll::Ready(Ok(_))), + "a forgotten verdict is asked again" + ); + } + /// Every group a set of ranges names, as a received copy's upstream terms judge them. #[cfg(feature = "async")] fn judged(runs: impl IntoIterator) -> Option> { diff --git a/rs/moq-net/src/model/track/fill.rs b/rs/moq-net/src/model/track/fill.rs index f3ba94b7242..d7ffc1e83a9 100644 --- a/rs/moq-net/src/model/track/fill.rs +++ b/rs/moq-net/src/model/track/fill.rs @@ -924,7 +924,13 @@ impl Fill { /// waiting for them, and the track records them so nobody asks again. Only the groups a /// reader still reads count; the rest of the fill was never owed. pub fn drop_groups(&self, groups: ops::Range) { - self.inner.drop_groups(groups, Error::NotFound, self.max_delay()); + let owed = self.inner.owed(groups); + self.inner.drop_groups( + &owed, + Error::NotFound, + super::Hole::drop(StreamError::NotFound), + self.max_delay(), + ); } /// Refuse `groups` with `err` without saying the source lost them, as when serving them @@ -1163,7 +1169,8 @@ impl Fill { } /// Refuse `groups` with the source's answer to a request for them: only [`Error::Old`] - /// under the publisher's max age (with every older group of the fill) is named dropped. + /// under the publisher's max age (with every older group of the fill) is recorded, as a + /// stale verdict under that age. #[cfg_attr(not(feature = "async"), allow(dead_code, reason = "async-only"))] pub(crate) fn reject_groups(&self, groups: ops::Range, err: Error) { self.inner.reject(groups, err, self.max_delay()); @@ -1309,20 +1316,18 @@ impl Inner { res } - /// Refuse `groups` with `err`, as the source answered under `asked`, recording them in - /// the track's drops when the source no longer has them, which binds every reader. Only - /// what a reader still reads: a handler refusing the whole fill never checked the rest. - fn drop_groups(&self, groups: ops::Range, err: Error, asked: Option) { - let unresolved = self.owed(groups); - if unresolved.is_empty() { + /// Refuse `groups` with `err`, as the source answered under `asked`, recording them in the + /// track's drops as `hole` says, so the later readers it settles do not ask again. + fn drop_groups(&self, groups: &RangeSet, err: Error, hole: super::Hole, asked: Option) { + if groups.is_empty() { return; } if let Ok(mut state) = TrackState::modify(&self.state) { - for groups in unresolved.iter() { - state.drop_unfed(groups.clone(), StreamError::from(&err)); + for groups in groups.iter() { + state.drop_unfed(groups.clone(), hole.clone()); } } - self.refuse(&unresolved, err, asked); + self.refuse(groups, err, asked); } /// The part of `groups` inside the fill that a reader still reads and nothing answered yet. @@ -1364,15 +1369,16 @@ impl Inner { } } - /// Whether an [`Error::Old`] answer under `asked` is the publisher's max age, which binds - /// every reader, rather than that budget, which a more tolerant reader may exceed. + /// The publisher's max age, when an [`Error::Old`] answer under `asked` reached it rather + /// than that budget, which a more tolerant reader may exceed: the budget that binds every + /// reader. `None` while the max age is unknown. #[cfg_attr(not(feature = "async"), allow(dead_code, reason = "async-only"))] - fn old_binds_everyone(&self, asked: Option) -> bool { - let Some(max_delay) = asked else { - return true; - }; - let bound = self.state.read().max_age_bound(); - bound.is_some_and(|bound| clamp_max_delay(max_delay, Some(bound)) >= bound) + fn binding_max_age(&self, asked: Option) -> Option { + let bound = self.state.read().max_age_bound()?; + match asked { + Some(max_delay) if clamp_max_delay(max_delay, Some(bound)) < bound => None, + _ => Some(bound), + } } /// Refuse `groups` with `err`, as their source answered a request for them under `asked`. @@ -1380,13 +1386,16 @@ impl Inner { fn reject(&self, groups: ops::Range, err: Error, asked: Option) { match err { // Stale under the fill's budget, and so is every group older than it: a timed - // track's starts never rewind. Only the publisher's max age binds every reader; - // under the fill's own budget they are withdrawn, for a reader with a wider one. + // track's starts never rewind. Under the publisher's max age it binds every reader, + // so the track holds it as a stale verdict under that age: retryable, it lasts only + // until new terms or the drop set's expiry window forget it. Under the fill's own + // budget, or a max age not known here, they are withdrawn, for a reader with a + // wider one. Error::Old => { let older = self.start.group..groups.end; - match self.old_binds_everyone(asked) { - true => self.drop_groups(older, Error::Old, asked), - false => { + match self.binding_max_age(asked) { + Some(bound) => self.drop_groups(&self.owed(older), Error::Old, super::Hole::stale(bound), asked), + None => { let unresolved = self.unresolved(older); self.refuse(&unresolved, Error::Old, asked); } @@ -1439,7 +1448,7 @@ impl Drop for Inner { if let Ok(mut state) = TrackState::modify(&self.state) { // Unanswered is a miss downstream, as an explicit `drop_groups` would say. for groups in left.iter() { - state.drop_unfed(groups.clone(), StreamError::NotFound); + state.drop_unfed(groups.clone(), super::Hole::drop(StreamError::NotFound)); } } if let Ok(mut outcome) = self.result.write() { @@ -1455,7 +1464,7 @@ impl Drop for Inner { impl TrackState { /// Record `groups` as dropped, as a fill's source answered, except what the cache holds /// or the live feed may still deliver: a fill refused is no verdict on the feed. - fn drop_unfed(&mut self, groups: ops::Range, err: StreamError) { + fn drop_unfed(&mut self, groups: ops::Range, hole: super::Hole) { // Until the serving session resolves where the feed starts, it may deliver anything. if matches!(self.start, super::Start::Pending(_)) { return; @@ -1468,7 +1477,7 @@ impl TrackState { } } for groups in dropped.iter() { - self.drop_groups(groups.clone(), super::Hole::drop(err.clone())); + self.drop_groups(groups.clone(), hole.clone()); } // The runs are billed, so a source refusing fills in fragments pays for them. if !dropped.is_empty() { @@ -1578,7 +1587,7 @@ impl GroupFill { /// Refuse the group with the source's answer, for the readers waiting now. Only /// [`Error::Old`] under the publisher's max age (with every older group of the fill) - /// names it dropped. + /// is recorded, as a stale verdict under that age. pub(crate) fn reject(self, err: Error) { self.inner.reject(self.sequence..self.sequence + 1, err, self.max_delay); }