tokio-rs / mio

Metal I/O library for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The UnixStream has an FD leakage problem.

silence-coding opened this issue · comments

commented

The UnixStream has an FD leakage problem.

When the socket_addr error occurs, the socket is not released.

    let socket = new_socket(libc::AF_UNIX, libc::SOCK_STREAM)?;
    let (sockaddr, socklen) = socket_addr(path)?;
    let sockaddr = &sockaddr as *const libc::sockaddr_un as *const libc::sockaddr;

Yup, good find.

I imagine most UDS implementations are the same. I'll take a look at them

commented

I took a look and found two places. Why not follow the standard library? When the socket is created, it returns a wrapper object, which is released in the drop method of the object.

commented

I imagine most UDS implementations are the same. I'll take a look at them

Thank you for your reply