Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.
This repository was archived by the owner on Apr 2, 2018. It is now read-only.

Consider generalizing TimeoutStream / adding an IdleStream adapter #35

Open
@mehcode

Description

@mehcode

In my project I need to execute some action if a stream has not responded for some amount of time and then continue with normal operation of the stream; essentially, an idle callback.

I copied TimeoutStream into my project and modified a few lines. Instead of raising on error on timeout I invoke a closure and resume polling the stream.

// [...]

            Ok(Async::Ready(_)) => {
                // Timeout has elapsed, reest and continue
                self.sleep = self.timer.sleep(self.duration);
                (self.on_idle)();

                self.poll()
            }

// [...]

Would this IdleStream be a good fit for inclusion in this crate ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions