Is your feature request related to a problem? Please describe.
Although very unconventional, it may be useful to bind a unix socket to a specific path. In my case, the listener calls UnixStream::peer_addr() upon accepting an incoming connection, and the path contains information necessary to process the connection.
Describe the solution you'd like
Allow users to create a UnixStream bound to a specific path. socket2 exposes a bind for this. I'm not sure how to make this fully backward compatible in tokio case though, since UnixStream::connect is currently the only way to create a socket.
Describe alternatives you've considered
- creating a socket2 socket, using
AsyncFd for the connection, then convert the socket into a tokio socket
- creating a socket2 socket, make a blocking
connect call, then convert the socket into a tokio socket
Is your feature request related to a problem? Please describe.
Although very unconventional, it may be useful to bind a unix socket to a specific path. In my case, the listener calls
UnixStream::peer_addr()upon accepting an incoming connection, and the path contains information necessary to process the connection.Describe the solution you'd like
Allow users to create a
UnixStreambound to a specific path.socket2exposes abindfor this. I'm not sure how to make this fully backward compatible in tokio case though, sinceUnixStream::connectis currently the only way to create a socket.Describe alternatives you've considered
AsyncFdfor the connection, then convert the socket into a tokio socketconnectcall, then convert the socket into a tokio socket