Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ impl Socket {
pub fn keepalive(&self) -> io::Result<bool> {
unsafe {
getsockopt::<Bool>(self.as_raw(), sys::SOL_SOCKET, sys::SO_KEEPALIVE)
.map(|keepalive| keepalive != 0)
.map(|keepalive| keepalive != false as Bool)
}
}

Expand Down Expand Up @@ -2219,7 +2219,7 @@ impl Socket {
pub fn tcp_nodelay(&self) -> io::Result<bool> {
unsafe {
getsockopt::<Bool>(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_NODELAY)
.map(|nodelay| nodelay != 0)
.map(|nodelay| nodelay != false as Bool)
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ pub(crate) const SOL_SOCKET: c_int = windows_sys::Win32::Networking::WinSock::SO
/// NOTE: <https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt>
/// 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;
Expand Down
Loading