async-std icon indicating copy to clipboard operation
async-std copied to clipboard

impl IntoRawFd for TcpStream closes the fd

Open boardwalk opened this issue 5 years ago • 1 comments

This code gets takes the TcpStream by value, gets its fd, and immediately destroys the TcpStream, likely destroying the fd:

    impl IntoRawFd for TcpStream {
        fn into_raw_fd(self) -> RawFd {
            self.as_raw_fd()
        }
    }

It looks like the other impls of IntoRawFd do self.watcher.into_inner().into_raw_fd() which seems correct comparatively.

boardwalk avatar Mar 19 '20 04:03 boardwalk

Even the documentation states that this would transfer ownership of the underlying fd. https://docs.rs/async-std/1.6.0/async_std/os/unix/io/trait.IntoRawFd.html.

Any updates?

rcmgleite avatar Jun 03 '20 01:06 rcmgleite