summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-05-30 10:36:01 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-05-30 10:36:01 (GMT)
commit255135d8edbce030f8090509d96551730d551add (patch)
tree447d0d68cfd0525c9be8a9289040710472b7b782 /win
parentd344208a62df4671dac9a66fa4589979bc68d7bb (diff)
parent46ad08baa493c06c277895adba74c64fce774dd4 (diff)
downloadtcl-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')
-rw-r--r--win/tclWinSock.c20
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);