diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2014-03-04 07:54:18 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2014-03-04 07:54:18 (GMT) |
commit | 3f6201e53876019daa3751675af6c3369de794fb (patch) | |
tree | 65299705a0e3899f177adac8c882a65555b692c9 | |
parent | 596cd02dba6671aac28f5601e92c37a8c200d194 (diff) | |
download | tcl-3f6201e53876019daa3751675af6c3369de794fb.zip tcl-3f6201e53876019daa3751675af6c3369de794fb.tar.gz tcl-3f6201e53876019daa3751675af6c3369de794fb.tar.bz2 |
Reverted move of WSAAsyncSelect before connect -> FD_Connect message does also fire if it exists on call.
-rw-r--r-- | win/tclWinSock.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ccae931..dd893ac 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1239,24 +1239,12 @@ CreateClientSocket( /* * Set the socket into nonblocking mode if the connect should * be done in the background. - * Activate notification for a connect. */ - if (async) { - if (ioctlsocket(infoPtr->sockets->fd, (long) FIONBIO, &flag) - == SOCKET_ERROR) { - DEBUG("FIONBIO"); - TclWinConvertError((DWORD) WSAGetLastError()); - continue; - } - { - ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); - infoPtr->flags |= SOCKET_ASYNC_CONNECT; - infoPtr->selectEvents |= FD_CONNECT; - - ioctlsocket(infoPtr->sockets->fd, (long) FIONBIO, &flag); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) infoPtr); - } + if (async && ioctlsocket(infoPtr->sockets->fd, (long) FIONBIO, &flag) + == SOCKET_ERROR) { + DEBUG("FIONBIO"); + TclWinConvertError((DWORD) WSAGetLastError()); + continue; } /* @@ -1271,8 +1259,15 @@ CreateClientSocket( #ifdef DEBUGGING // fprintf(stderr,"error = %lu\n", error); #endif - if (async && error == WSAEWOULDBLOCK) { + if (error == WSAEWOULDBLOCK) { + ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); DEBUG("WSAEWOULDBLOCK"); + infoPtr->flags |= SOCKET_ASYNC_CONNECT; + infoPtr->selectEvents |= FD_CONNECT; + + ioctlsocket(infoPtr->sockets->fd, (long) FIONBIO, &flag); + SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, + (LPARAM) infoPtr); return TCL_OK; } else { DEBUG("ELSE"); |