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
31 changes: 0 additions & 31 deletions quest/m2/ts-follow-retry.md

This file was deleted.

17 changes: 11 additions & 6 deletions rs/moq-mux/src/container/ts/export_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9951,9 +9951,9 @@ fn finish((broadcast, mut catalog): (moq_net::origin::Route, crate::catalog::Pro
#[tokio::test(start_paused = true)]
async fn a_follower_fails_at_once_on_its_own_failure() {
let causes = [
moq_net::Error::Cancel,
moq_net::Error::Stream(moq_net::StreamError::Internal),
moq_net::Error::MalformedTrack,
moq_net::Error::NotFound,
moq_net::Error::Stream(moq_net::StreamError::MalformedTrack),
];
for cause in causes {
let origin = crate::source::produce_origin();
Expand All @@ -9978,16 +9978,21 @@ async fn a_follower_fails_at_once_on_its_own_failure() {
}
}

/// A track that lost its route, or whose session ended, says the publisher left even with the
/// broadcast still announced: the follower waits out the follow for a return, then fails with
/// that cause. moq-transport's PUBLISH_DONE has no code for a lost route, so a relay's copy
/// reads there as an unregistered one.
/// A track that failed to deliver, as `retry` answers, says the publisher left even with the
/// broadcast still announced: a lost route, an ended session, a cancel, or a going away. The
/// follower waits out the follow for a return, then fails with that cause. moq-transport's
/// PUBLISH_DONE has no code for a lost route, so a relay's copy reads there as an unregistered
/// one.
#[tokio::test(start_paused = true)]
async fn a_follower_waits_out_the_follow_on_a_lost_route() {
let causes = [
moq_net::Error::Unroutable,
moq_net::Error::Stream(moq_net::StreamError::Unroutable),
moq_net::Error::Session(moq_net::SessionError::Cancel),
moq_net::Error::Cancel,
moq_net::Error::GoingAway,
moq_net::Error::Stream(moq_net::StreamError::Internal),
moq_net::Error::Stream(moq_net::StreamError::GoingAway),
moq_net::Error::Remote(0),
];
for cause in causes {
Expand Down
28 changes: 11 additions & 17 deletions rs/moq-mux/src/container/ts/follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ enum State<E: catalog::Catalog> {
/// switches the program to it at once. Subscriptions are sticky, so without stitching a
/// replaced publisher that stays up keeps the export until it ends.
///
/// A track failure is followed only when its cause says the publisher left: the route serving
/// it was lost (`Unroutable`, which a moq-lite relay resets a copy with once its upstream
/// session ends), the session carrying it ended, or a moq-transport peer ended it with a code
/// it does not register, since PUBLISH_DONE has none for a lost route. Any other failure is
/// the export's own and fails here at once.
/// A track failure is followed only when its cause says the publisher left: the source failed
/// to deliver, as [`moq_net::Error::retry`] answers (a lost route, an ended session, a cancel,
/// or a going away), or a moq-transport peer ended it with a code it does not register, since
/// PUBLISH_DONE has none for a lost route. Any other failure is the export's own and fails
/// here at once.
///
/// An instance that comes back is awaited until its catalog serves a first snapshot, with no
/// deadline but its own end. A return that refuses its catalog waits for the next change, and
Expand Down Expand Up @@ -418,20 +418,14 @@ impl<E: catalog::Catalog + 'static> Follower<E> {
}
}

/// Whether a failure says the publisher left rather than the export failing: the route serving
/// the broadcast was lost, the session carrying it ended, or a moq-transport peer named no cause.
/// Whether a failure says the publisher left rather than the export failing: the source failed
/// to deliver (see [`moq_net::Error::retry`]), or a moq-transport peer named no cause.
///
/// moq-transport's PUBLISH_DONE has no code for a lost route, so a relay's lost upstream and a
/// publisher's own failure both end with an unregistered one, which `retry` cannot answer for.
pub(super) fn left(err: &crate::Error) -> bool {
let (crate::Error::Moq(err) | crate::Error::Hang(hang::Error::Moq(err))) = err else {
return false;
};
use moq_net::{Error, StreamError};
matches!(
err,
Error::Unroutable
| Error::Stream(StreamError::Unroutable | StreamError::Session(_))
| Error::Session(_)
| Error::Transport(_)
| Error::IdleTimeout
| Error::Remote(_)
)
err.retry() != moq_net::Retry::Never || matches!(err, moq_net::Error::Remote(_))
}