summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-03-14 10:59:48 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-03-14 10:59:48 (GMT)
commit7dc014d8e0a311dd0298724157b449414392b33d (patch)
tree98a3d9c93e5160c5fb947d014044b15b1c838f9c /win/tclWinSock.c
parentf52bc4c0b11afcb0144f828bd128be56202099a6 (diff)
downloadtcl-7dc014d8e0a311dd0298724157b449414392b33d.zip
tcl-7dc014d8e0a311dd0298724157b449414392b33d.tar.gz
tcl-7dc014d8e0a311dd0298724157b449414392b33d.tar.bz2
Remove writable shortcut and errorneous workaround to get [connect -async] fail error to [fconfigure -error]bug_13d3af3ad5_fork
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 0ea8f04..d9b9789 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -170,8 +170,7 @@ struct SocketInfo {
struct addrinfo *myaddr; /* Iterator over myaddrlist. */
int status; /* Cache status of async socket. */
int cachedBlocking; /* Cache blocking mode of async socket. */
- int lastError; /* Error code from notifier thread. */
- int connectError; /* Error code from failed async connect. */
+ int lastError; /* Error code from last message. */
struct SocketInfo *nextPtr; /* The next socket on the per-thread socket
* list. */
};
@@ -780,13 +779,9 @@ SocketEventProc(
infoPtr->readyEvents &= ~(FD_CONNECT);
DEBUG("FD_CONNECT");
if ( infoPtr->flags & SOCKET_REENTER_PENDING ) {
- /* free list lock */
SetEvent(tsdPtr->socketListLock);
- /* Do one connect step */
- if (TCL_OK != CreateClientSocket(NULL, infoPtr) ) {
- /* On final fail save error for fconfigure -error */
- infoPtr->connectError = Tcl_GetErrno();
- }
+ CreateClientSocket(NULL, infoPtr);
+ return 1;
}
}
@@ -2476,26 +2471,31 @@ TcpGetOptionProc(
/* connect terminated with error */
Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(errorCode), -1);
}
- } else if (infoPtr->connectError != 0) {
- /*
- * An async connect error was not jet reported.
- */
- Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(infoPtr->connectError), -1);
- infoPtr->connectError = 0;
+
} else {
int optlen;
int ret;
DWORD err;
+ /*
+ * Populater the err Variable with a possix error
+ */
optlen = sizeof(int);
ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR,
(char *)&err, &optlen);
+ /*
+ * The error was not returned directly but should be
+ * taken from WSA
+ */
if (ret == SOCKET_ERROR) {
err = WSAGetLastError();
- if (err) {
- TclWinConvertError(err);
- Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
- }
+ }
+ /*
+ * Return error message
+ */
+ if (err) {
+ TclWinConvertError(err);
+ Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
}
}
return TCL_OK;