Skip to content

Commit 71f7800

Browse files
committed
TCP_FASTOPEN getsockopt on Windows returns a 1-byte value
1 parent 2a2bf8e commit 71f7800

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/socket.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,10 +1533,15 @@ impl Socket {
15331533
target_os = "windows"
15341534
))]
15351535
pub fn tcp_fastopen(&self) -> io::Result<u32> {
1536+
#[cfg(not(target_os = "windows"))]
15361537
unsafe {
15371538
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_FASTOPEN)
15381539
.map(|c| c as u32)
15391540
}
1541+
#[cfg(target_os = "windows")]
1542+
unsafe {
1543+
getsockopt::<u8>(self.as_raw(), sys::IPPROTO_TCP, sys::TCP_FASTOPEN).map(|c| c as u32)
1544+
}
15401545
}
15411546
}
15421547

0 commit comments

Comments
 (0)