From 78bb5378e9246dab5774d2d17c3397f36f0658cf Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 29 May 2014 14:56:10 +0000 Subject: Try not to loose FD_CONNECT by switching monitoring off. --- win/tclWinSock.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index e18a3dd..ae9ba17 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1239,13 +1239,17 @@ WaitForSocketEvent( /* * Reset WSAAsyncSelect so we have a fresh set of events pending. + * Don't do that if we are waiting for a connect as this may ignore + * a failed connect. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, - (LPARAM) infoPtr); - - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) infoPtr); + if ( 0 == (events & FD_CONNECT) ) { + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, + (LPARAM) infoPtr); + + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, + (LPARAM) infoPtr); + } while (1) { if (infoPtr->lastError) { -- cgit v0.12