From 0260054a8cf0ca8642994847e4c64156f0adc983 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 18 May 2001 08:33:33 +0000 Subject: [PATCH] * net.cc (wsock_event::wait): Explicitely cancel IO when a signal arrived to avoid data loss. Fallback to blocking IO when canceling fails. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/net.cc | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6a9ea4bce..c187f134f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Fri May 18 10:31:00 2001 Corinna Vinschen + + * net.cc (wsock_event::wait): Explicitely cancel IO when a signal + arrived to avoid data loss. Fallback to blocking IO when canceling + fails. + Thu May 17 15:29:00 2001 Corinna Vinschen * security.cc (cygwin_set_impersonation_token): Never destroy diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index c63fa3c33..5fbc92e8d 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -90,7 +90,13 @@ wsock_event::wait (int socket, LPDWORD flags) ret = (int) len; break; case WSA_WAIT_EVENT_0 + 1: - WSASetLastError (WSAEINTR); + if (!CancelIo ((HANDLE)socket)) + { + debug_printf ("CancelIo() %E, fallback to blocking io"); + WSAGetOverlappedResult(socket, &ovr, &len, TRUE, flags); + } + else + WSASetLastError (WSAEINTR); break; case WSA_WAIT_FAILED: break;