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

Device::into_event_stream() drops device on error #144

Open
Hurricane996 opened this issue Feb 13, 2024 · 1 comment
Open

Device::into_event_stream() drops device on error #144

Hurricane996 opened this issue Feb 13, 2024 · 1 comment

Comments

@Hurricane996
Copy link

If you call Device::into_event_stream() and it fails, the device is dropped and has no way to recover it. If you would like to use any information off of the Device struct in your error handling, you have to clone the relevant information before even calling Device::into_event_stream. The solution to this would be to have an IntoEventStreamError which includes the underlying io::Error as well as the Device, allowing users to query information off of the device in event of an error.

The solution is to create a custom error type which contains the underlying device. Unfortunately, AsyncFd::new has the same issue, so this would be reliant on Tokio doing the same thing. I will create an issue upstream as well.

@Hurricane996
Copy link
Author

tokio-rs/tokio#6344

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

No branches or pull requests

1 participant