-
Notifications
You must be signed in to change notification settings - Fork 13.8k
std: sys::net
cleanups
#147190
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
base: master
Are you sure you want to change the base?
std: sys::net
cleanups
#147190
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
r? libs |
let mut len = size_of_val(&storage) as c::socklen_t; | ||
let mut storage = MaybeUninit::<c::sockaddr_storage>::uninit(); | ||
let mut len = size_of::<c::sockaddr_storage>() as c::socklen_t; | ||
let sock = self.inner.accept(storage.as_mut_ptr() as *mut _, &mut len)?; |
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.
perhaps add let storage = storage.assume_init()
here?
} | ||
|
||
pub fn new_raw(fam: i32, ty: i32) -> io::Result<Socket> { | ||
pub fn new(fam: i32, ty: i32) -> io::Result<Socket> { |
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.
The other impls seem to use c_int
instead of i32
for these parameters.
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.
hermit_abi
uses i32
for socket
, so it's probably best to use it here as well.
This PR contains three improvements to the socket-based networking implementation (aa1263e is just to add the now missing
unsafe
). Best reviewed commit-by-commit.