diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2014-05-30 10:36:01 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2014-05-30 10:36:01 (GMT) |
commit | 312e71eff44c59b48e01cab1718d8ab2b426702c (patch) | |
tree | 447d0d68cfd0525c9be8a9289040710472b7b782 /win/tclWinSock.c | |
parent | 334ffdfa501158f3dd054d3c0de7102620fd8d6c (diff) | |
parent | 78bb5378e9246dab5774d2d17c3397f36f0658cf (diff) | |
download | tcl-312e71eff44c59b48e01cab1718d8ab2b426702c.zip tcl-312e71eff44c59b48e01cab1718d8ab2b426702c.tar.gz tcl-312e71eff44c59b48e01cab1718d8ab2b426702c.tar.bz2 |
win socket -async: do not loose connect notification by temporarily stop connect monitoring. Bug [336441ed59]
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r-- | win/tclWinSock.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c index e18a3dd..8f565b9 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 we may miss + * a connect (bug 336441ed59). */ - 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) { @@ -2409,11 +2413,15 @@ SocketProc( case SOCKET_SELECT: infoPtr = (SocketInfo *) lParam; if (wParam == SELECT) { + /* + * Start notification by windows messages on socket events + */ + WSAAsyncSelect(infoPtr->socket, hwnd, SOCKET_MESSAGE, infoPtr->selectEvents); } else { /* - * Clear the selection mask + * UNSELECT: Clear the selection mask */ WSAAsyncSelect(infoPtr->socket, hwnd, 0, 0); |