summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-03-04 07:54:18 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-03-04 07:54:18 (GMT)
commitc5233a1a3eb0706c49c436bda255bbcdac5bf009 (patch)
tree65299705a0e3899f177adac8c882a65555b692c9 /win
parentd2d1d997780ab3a1651986fc9820fd4a75ea8e56 (diff)
downloadtcl-c5233a1a3eb0706c49c436bda255bbcdac5bf009.zip
tcl-c5233a1a3eb0706c49c436bda255bbcdac5bf009.tar.gz
tcl-c5233a1a3eb0706c49c436bda255bbcdac5bf009.tar.bz2
Reverted move of WSAAsyncSelect before connect -> FD_Connect message does also fire if it exists on call.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinSock.c31
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");