Skip to content

Commit

Permalink
Update windows-sys to 0.48
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored and Thomasdezeeuw committed Apr 3, 2023
1 parent 4c55898 commit f5cb0b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ features = ["all"]
libc = "0.2.139"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.45"
version = "0.48"
features = [
"Win32_Foundation",
"Win32_Networking_WinSock",
"Win32_System_IO",
"Win32_System_Threading",
"Win32_System_WindowsProgramming",
]

Expand Down
14 changes: 7 additions & 7 deletions src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use windows_sys::Win32::Networking::WinSock::{
SOCKET_ERROR, WSABUF, WSAEMSGSIZE, WSAESHUTDOWN, WSAPOLLFD, WSAPROTOCOL_INFOW,
WSA_FLAG_NO_HANDLE_INHERIT, WSA_FLAG_OVERLAPPED,
};
use windows_sys::Win32::System::WindowsProgramming::INFINITE;
use windows_sys::Win32::System::Threading::INFINITE;

use crate::{RecvFlags, SockAddr, TcpKeepalive, Type};

Expand Down Expand Up @@ -638,7 +638,7 @@ pub(crate) fn send_to_vectored(
}

/// Wrapper around `getsockopt` to deal with platform specific timeouts.
pub(crate) fn timeout_opt(fd: Socket, lvl: c_int, name: u32) -> io::Result<Option<Duration>> {
pub(crate) fn timeout_opt(fd: Socket, lvl: c_int, name: i32) -> io::Result<Option<Duration>> {
unsafe { getsockopt(fd, lvl, name).map(from_ms) }
}

Expand All @@ -656,7 +656,7 @@ fn from_ms(duration: u32) -> Option<Duration> {
pub(crate) fn set_timeout_opt(
socket: Socket,
level: c_int,
optname: u32,
optname: i32,
duration: Option<Duration>,
) -> io::Result<()> {
let duration = into_ms(duration);
Expand Down Expand Up @@ -703,14 +703,14 @@ pub(crate) fn set_tcp_keepalive(socket: Socket, keepalive: &TcpKeepalive) -> io:

/// Caller must ensure `T` is the correct type for `level` and `optname`.
// NOTE: `optname` is actually `i32`, but all constants are `u32`.
pub(crate) unsafe fn getsockopt<T>(socket: Socket, level: c_int, optname: u32) -> io::Result<T> {
pub(crate) unsafe fn getsockopt<T>(socket: Socket, level: c_int, optname: i32) -> io::Result<T> {
let mut optval: MaybeUninit<T> = MaybeUninit::uninit();
let mut optlen = mem::size_of::<T>() as c_int;
syscall!(
getsockopt(
socket,
level as i32,
optname as i32,
optname,
optval.as_mut_ptr().cast(),
&mut optlen,
),
Expand All @@ -729,14 +729,14 @@ pub(crate) unsafe fn getsockopt<T>(socket: Socket, level: c_int, optname: u32) -
pub(crate) unsafe fn setsockopt<T>(
socket: Socket,
level: c_int,
optname: u32,
optname: i32,
optval: T,
) -> io::Result<()> {
syscall!(
setsockopt(
socket,
level as i32,
optname as i32,
optname,
(&optval as *const T).cast(),
mem::size_of::<T>() as c_int,
),
Expand Down

0 comments on commit f5cb0b1

Please sign in to comment.