Skip to content

Commit

Permalink
cargo fmt and more specific imports
Browse files Browse the repository at this point in the history
Signed-off-by: keithmattix <keithmattix@microsoft.com>
  • Loading branch information
keithmattix committed Sep 12, 2024
1 parent 69ca302 commit b4a47f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ use std::time::{Duration, Instant};
use std::{process, ptr, slice};

use windows_sys::Win32::Foundation::{SetHandleInformation, HANDLE, HANDLE_FLAG_INHERIT};
#[cfg(feature = "all")]
use windows_sys::Win32::Networking::WinSock::{SO_PROTOCOL_INFOW, SO_ORIGINAL_DST, IP6T_SO_ORIGINAL_DST, SOL_IP};
use windows_sys::Win32::Networking::WinSock::{
self, tcp_keepalive, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR, IN_ADDR_0,
POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, SD_BOTH, SD_RECEIVE, SD_SEND, SIO_KEEPALIVE_VALS,
SOCKET_ERROR, WSABUF, WSAEMSGSIZE, WSAESHUTDOWN, WSAPOLLFD, WSAPROTOCOL_INFOW,
WSA_FLAG_NO_HANDLE_INHERIT, WSA_FLAG_OVERLAPPED
WSA_FLAG_NO_HANDLE_INHERIT, WSA_FLAG_OVERLAPPED,
};
#[cfg(feature = "all")]
use windows_sys::Win32::Networking::WinSock::{
IP6T_SO_ORIGINAL_DST, SOL_IP, SO_ORIGINAL_DST, SO_PROTOCOL_INFOW,
};
use windows_sys::Win32::System::Threading::INFINITE;

Expand Down Expand Up @@ -77,7 +79,7 @@ pub(crate) use windows_sys::Win32::Networking::WinSock::{
IP_MREQ_SOURCE as IpMreqSource, IP_MULTICAST_IF, IP_MULTICAST_LOOP, IP_MULTICAST_TTL,
IP_RECVTOS, IP_TOS, IP_TTL, LINGER as linger, MSG_OOB, MSG_PEEK, SO_BROADCAST, SO_ERROR,
SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDBUF,
SO_SNDTIMEO, SO_TYPE, TCP_NODELAY
SO_SNDTIMEO, SO_TYPE, TCP_NODELAY,
};
pub(crate) const IPPROTO_IP: c_int = windows_sys::Win32::Networking::WinSock::IPPROTO_IP as c_int;
pub(crate) const SOL_SOCKET: c_int = windows_sys::Win32::Networking::WinSock::SOL_SOCKET as c_int;
Expand Down Expand Up @@ -941,10 +943,10 @@ impl crate::Socket {
SO_ORIGINAL_DST as i32,
storage.cast(),
len,
),
PartialEq::eq,
SOCKET_ERROR
)
),
PartialEq::eq,
SOCKET_ERROR
)
})
}
.map(|(_, addr)| addr)
Expand All @@ -964,10 +966,10 @@ impl crate::Socket {
IP6T_SO_ORIGINAL_DST as i32,
storage.cast(),
len,
),
PartialEq::eq,
SOCKET_ERROR
)
),
PartialEq::eq,
SOCKET_ERROR
)
})
}
.map(|(_, addr)| addr)
Expand Down
1 change: 1 addition & 0 deletions tests/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use std::num::NonZeroUsize;
use std::os::unix::io::AsRawFd;
#[cfg(windows)]
use std::os::windows::io::AsRawSocket;
#[cfg(windows)]
use windows_sys::Win32::Networking::WinSock::WSAEINVAL;

#[cfg(unix)]
Expand Down

0 comments on commit b4a47f4

Please sign in to comment.