From 48f409dcda65ae7ccb0ad4ad0aa8bdc067f13ca0 Mon Sep 17 00:00:00 2001 From: Riccardo Zaglia Date: Tue, 19 Nov 2024 18:26:07 +0100 Subject: [PATCH] fix(sockets): :bug: Ignore error 997 (overlapped IO) --- alvr/common/src/connection_result.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alvr/common/src/connection_result.rs b/alvr/common/src/connection_result.rs index 2cd8df920d..cb29dc7456 100644 --- a/alvr/common/src/connection_result.rs +++ b/alvr/common/src/connection_result.rs @@ -65,7 +65,11 @@ pub trait HandleTryAgain { impl HandleTryAgain for io::Result { fn handle_try_again(self) -> ConResult { self.map_err(|e| { - if e.kind() == io::ErrorKind::TimedOut || e.kind() == io::ErrorKind::WouldBlock { + // Ignore ERROR_IO_PENDING on Windows (code 997) + if e.kind() == io::ErrorKind::TimedOut + || e.kind() == io::ErrorKind::WouldBlock + || (cfg!(windows) && e.raw_os_error() == Some(997)) + { ConnectionError::TryAgain(e.into()) } else { ConnectionError::Other(e.into())