rust-lang-nursery/unix-socket

Support interruption of accept()

panicbit opened this issue · 1 comments

In an earlier Rust implementation of unix sockets you could abort accept() calls.

Methods like close_accept were removed because they didn't match up to the goals for std::io. Specifically, close_accept was implemented by spawning a pipe, storing a separate "closed" state in an atomic type, switching the socket into nonblocking mode and then selecting over the socket and one end of the pipe in a loop: https://github.com/rust-lang/rust/blob/ba4081a5a8573875fed17545846f6f6902c8ba8d/src/libnative/io/pipe_unix.rs#L266-L328.

I'm keeping this crate a pretty close mirror of the std::net APIs so something of this complexity doesn't seem like something that makes sense to implement.