diff --git a/Cargo.toml b/Cargo.toml index 02b12b48..da9e62f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ features = ["all"] libc = "0.2.172" [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.59" +version = "0.60" features = [ "Win32_Foundation", "Win32_Networking_WinSock", diff --git a/src/socket.rs b/src/socket.rs index 1afb50d9..22fe858b 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -871,7 +871,7 @@ impl Socket { pub fn keepalive(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::SOL_SOCKET, sys::SO_KEEPALIVE) - .map(|keepalive| keepalive != 0) + .map(|keepalive| keepalive != false as Bool) } } @@ -2219,7 +2219,7 @@ impl Socket { pub fn tcp_nodelay(&self) -> io::Result { unsafe { getsockopt::(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_NODELAY) - .map(|nodelay| nodelay != 0) + .map(|nodelay| nodelay != false as Bool) } } diff --git a/src/sys/windows.rs b/src/sys/windows.rs index 33678bc2..2d43e2bf 100644 --- a/src/sys/windows.rs +++ b/src/sys/windows.rs @@ -93,9 +93,8 @@ pub(crate) const SOL_SOCKET: c_int = windows_sys::Win32::Networking::WinSock::SO /// NOTE: /// documents that options such as `TCP_NODELAY` and `SO_KEEPALIVE` expect a /// `BOOL` (alias for `c_int`, 4 bytes), however in practice this turns out to -/// be false (or misleading) as a `BOOLEAN` (`c_uchar`, 1 byte) is returned by -/// `getsockopt`. -pub(crate) type Bool = windows_sys::Win32::Foundation::BOOLEAN; +/// be false (or misleading) as a `bool` (1 byte) is returned by `getsockopt`. +pub(crate) type Bool = bool; /// Maximum size of a buffer passed to system call like `recv` and `send`. const MAX_BUF_LEN: usize = c_int::MAX as usize;