-
Notifications
You must be signed in to change notification settings - Fork 741
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
Replace Unix SocketAddr with std version #1749
Conversation
fee7fcd
to
1c646e1
Compare
src/sys/unix/uds/mod.rs
Outdated
#[cfg(target_os = "linux")] | ||
None => match address.as_abstract_name() { | ||
Some(name) => { | ||
offset += 1; | ||
name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that technically this change does not mean that the MSRV cannot be lower than 1.70.0. You can use a build script to detect the rustc version and only include this branch if the rustc is at least 1.70.0. This works because the user cannot construct a SocketAddr
with an abstract name on older rustc.
We used this technique in Tokio to support the IO safety traits before our MSRV supported them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's increasing the MSRV, that was the goal for Mio v1.
I'm not going to mess around with a build script. I've seen it in the log and libc crates as well as a few others and it's always been a pain to maintain them. Mio v1 is simply going to have a higher MSRV.
Replaces mio::net::SocketAddr with std::os::unix::net::SocketAddr. With this change the path based API to create the sockets ({UnixDatagram,UnixListener}::bind and UnixStream::connect) will no longer work with abstract namespaces. For that the _addr variant must be used and the address created by using SocketAddr::from_abstract_name (part of the std::os::linux::net::SocketAddrExt trait). Adds UnixDatagram::bind_addr to match UnixStream::connect_addr and UnixListener::bind_addr. Expands the unix_listener_abstract_namespace test to actually create a listener and use it. Closes #1527
It seems to return a length of 16 and an all zero address for unnamed Unix addresses.
mem::zeroed has been undeprecrated.
71b80e3
to
d992f78
Compare
Rebased this and address all feedback from @Darksonn (only took me six months 😅) |
Matching what we do in the unix_addr function.
Should have expected that Darwin copied it from FreeBSD, but oh well.
9de37c5
to
e2dd181
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change the path based API to create the sockets ({UnixDatagram,UnixListener}::bind and UnixStream::connect) will no longer work with abstract namespaces. For that the _addr variant must be used and the address created by using SocketAddr::from_abstract_name (part of the std::os::linux::net::SocketAddrExt trait).
Please make sure to mention this in your v1.0.0 changelog under the list of breaking changes.
👍 the changelog will be fun to make for this release 😉 |
Replaces mio::net::SocketAddr with std::os::unix::net::SocketAddr.
With this change the path based API to create the sockets ({UnixDatagram,UnixListener}::bind and UnixStream::connect) will no longer work with abstract namespaces. For that the _addr variant must be used and the address created by using SocketAddr::from_abstract_name (part of the std::os::linux::net::SocketAddrExt trait).
Adds UnixDatagram::bind_addr to match UnixStream::connect_addr and UnixListener::bind_addr.
Expands the unix_listener_abstract_namespace test to actually create a listener and use it.
Closes #1527