Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop streams automatically once dropped #14

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Stop streams automatically once dropped #14

wants to merge 5 commits into from

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jun 1, 2024

This adds a guard to streams that automatically issues a STOP once dropped.

Implementing this required a rather major change to the implementation, namely wrapping the internal state into Arc/Mutex/atomics to make Lighthouse cloneable, since the stop guard requires keeping a reference to the Lighthouse alive (dynamically). This refactoring is implemented in the lh-shared-state branch, which this PR is based upon.

@fwcd fwcd added the enhancement New feature or request label Jun 1, 2024
Comment on lines +215 to +224
let path: Vec<_> = path.into_iter().map(|s| s.to_string()).collect();
move || {
tokio::spawn(async move {
// TODO: Find a more elegant way to pass the path, ideally without
// converting back and forth between Vec<String>, Vec<&str> and &[&str]
let path: Vec<_> = path.iter().map(|s| &**s).collect();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation note: The (rather messy) second conversion would potentially be redundant with #15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant