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
5 changes: 4 additions & 1 deletion rs/moq-net/src/model/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,10 @@ pub struct Consumer {
}

/// Subscriber-specific policy for expiring a group after it was handed out.
pub(crate) trait Expiry: Send + Sync {
///
/// Unwind safe so the [`Consumer`] holding it is, and so the published
/// [`track::Fetching`] that holds a consumer stays unwind safe too.
pub(crate) trait Expiry: Send + Sync + std::panic::UnwindSafe + std::panic::RefUnwindSafe {
/// Return whether the group is stale, registering `waiter` for anything that
/// could change the answer while the group remains live.
fn is_expired(&self, waiter: &kio::Waiter) -> bool;
Expand Down
9 changes: 9 additions & 0 deletions rs/moq-net/src/model/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8080,6 +8080,15 @@ mod test {
assert_eq!(retry.await.unwrap().sequence, 5);
}

/// Dropping an auto trait from a published type is a semver break, so the group
/// consumer a cached fetch holds must not cost `Fetching` its unwind safety.
#[test]
fn fetching_is_unwind_safe() {
fn assert_unwind_safe<T: std::panic::UnwindSafe + std::panic::RefUnwindSafe>() {}
assert_unwind_safe::<Fetching>();
assert_unwind_safe::<group::Consumer>();
}

/// A fetch that hits the cache holds the group until polled, so a handler that aborts
/// the group once nobody wants it (an abandoned upstream fetch) leaves it alone.
#[tokio::test]
Expand Down
Loading