Skip to content

Commit 0450427

Browse files
authored
Port to windows-sys (#102)
1 parent 823d6f1 commit 0450427

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ autocfg = "1"
3636
libc = "0.2.77"
3737

3838
[target.'cfg(windows)'.dependencies]
39-
winapi = { version = "0.3.9", features = ["winsock2"] }
39+
windows-sys = { version = "0.42", features = ["Win32_Networking_WinSock"] }
4040

4141
[dev-dependencies]
4242
async-channel = "1"

src/lib.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,10 @@ impl<T: AsRawSocket> Async<T> {
681681

682682
// Put the socket in non-blocking mode.
683683

684-
use winapi::ctypes;
685-
use winapi::um::winsock2;
686-
687-
let mut nonblocking = true as ctypes::c_ulong;
688-
let res = unsafe {
689-
winsock2::ioctlsocket(
690-
sock as winsock2::SOCKET,
691-
winsock2::FIONBIO,
692-
&mut nonblocking,
693-
)
694-
};
684+
use windows_sys::Win32::Networking::WinSock;
685+
686+
let mut nonblocking = true as _;
687+
let res = unsafe { WinSock::ioctlsocket(sock as _, WinSock::FIONBIO, &mut nonblocking) };
695688
if res != 0 {
696689
return Err(io::Error::last_os_error());
697690
}

0 commit comments

Comments
 (0)