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 | 255135d8edbce030f8090509d96551730d551add (patch) | |
tree | 447d0d68cfd0525c9be8a9289040710472b7b782 /win/tclWinSock.c | |
parent | d344208a62df4671dac9a66fa4589979bc68d7bb (diff) | |
parent | 46ad08baa493c06c277895adba74c64fce774dd4 (diff) | |
download | tcl-255135d8edbce030f8090509d96551730d551add.zip tcl-255135d8edbce030f8090509d96551730d551add.tar.gz tcl-255135d8edbce030f8090509d96551730d551add.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); |