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

More Readiness events? #203

Open
vikigenius opened this issue Jul 25, 2024 · 3 comments · May be fixed by #210
Open

More Readiness events? #203

vikigenius opened this issue Jul 25, 2024 · 3 comments · May be fixed by #210

Comments

@vikigenius
Copy link

I see that Mio has support for:

is_read_closed

is_write_closed

Can we get that in Calloop as well?

I am trying to use a client server architecture with Unix Sockets. Multiple clients can connect to the server. In rust every time there is a new connection to UnixListener it get's it's own UnixStream. I would like to keep track of connections so that I can send messages to appropriate streams.

But I also need to detect when the stream has been shutdown and we know that we won't receive anymore data in it.

Is there a reason why these aren't implemented? It seems like Mio does it using EPOLLHUP, EPOLLIN, EPOLLRDHUP.
Is there a way to achieve this in calloop already that I don't know about?

@notgull
Copy link
Member

notgull commented Jul 26, 2024

polling has support for is_interrupt (usually corresponds to HUP), which I think fits the bill here.

@vikigenius
Copy link
Author

@notgull Seems like it, looks like it maintains an extra field

/// Indicates that a file descriptor or socket can read or write without blocking.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Event {
    /// Key identifying the file descriptor or socket.
    pub key: usize,
    /// Can it do a read operation without blocking?
    pub readable: bool,
    /// Can it do a write operation without blocking?
    pub writable: bool,
    /// System-specific event data.
    extra: sys::EventExtra,
}

Can calloop do something similar by maintaining an extra field in the Readiness struct and implementing is_interrupt using that? I am willing to contribute if this is something that you are interested in? I don't think this should be a breaking change?

@notgull
Copy link
Member

notgull commented Sep 6, 2024

I am willing to contribute if this is something that you are interested in?

Sorry for the delay. Yes I would be interested.

@vikigenius vikigenius linked a pull request Sep 16, 2024 that will close this issue
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 a pull request may close this issue.

2 participants