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

Replace event_stream() with into_event_stream() #199

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

talklittle
Copy link
Contributor

Also adds EventStream.into_inotify() to convert back
to an Inotify.

event_stream() was problematic because it could allow
a caller to inadvertently create multiple streams
reading and contending over the same source, resulting
in unpredictable event emission.

Fixes #176

Also adds EventStream.into_inotify() to convert back
to an Inotify.

event_stream() was problematic because it could allow
a caller to inadvertently create multiple streams
reading and contending over the same source, resulting
in unpredictable event emission.
Copy link
Owner

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

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

Thank you, @talklittle. Looks great!

@hannobraun hannobraun merged commit 2fc1668 into hannobraun:master Aug 22, 2022
edmondsfastly added a commit to fastly/dnstap-utils that referenced this pull request Jan 13, 2024
See hannobraun/inotify-rs#199

Fixes the following diagnostics:

    warning: use of deprecated method `inotify::Inotify::event_stream`: use `into_event_stream()` instead, which enforces a single Stream and predictable reads
      --> src/bin/dnstap-replay/monitor_handler.rs:43:39
       |
    43 |         let mut stream = self.inotify.event_stream(&mut buffer)?;
       |                                       ^^^^^^^^^^^^
       |
       = note: `#[warn(deprecated)]` on by default

    warning: use of deprecated method `inotify::Inotify::add_watch`: use `Inotify.watches().add()` instead
       --> src/bin/dnstap-replay/monitor_handler.rs:166:26
        |
    166 |         let wd = inotify.add_watch(
        |                          ^^^^^^^^^
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

Successfully merging this pull request may close these issues.

Inotify::event_stream is error-prone
2 participants