summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-03-14 14:36:14 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-03-14 14:36:14 (GMT)
commit89de66b1c01fe7b56aae89cec3b35827c27ce65c (patch)
tree802081a70e65c01ce9673bb0218a487453ef1bd6 /win/tclWinSock.c
parentc02f2ee223615fe5b82e63c097199e34d0803814 (diff)
parent7dc014d8e0a311dd0298724157b449414392b33d (diff)
downloadtcl-89de66b1c01fe7b56aae89cec3b35827c27ce65c.zip
tcl-89de66b1c01fe7b56aae89cec3b35827c27ce65c.tar.gz
tcl-89de66b1c01fe7b56aae89cec3b35827c27ce65c.tar.bz2
Remove writable shortcut and errorneous workaround to get [connect -async] fail error to [fconfigure -error]
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;