diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2014-03-11 13:35:37 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2014-03-11 13:35:37 (GMT) |
commit | ad739fa25ae937cd6dc5435db43f36c310d3a738 (patch) | |
tree | ed68c0436ceb2bbf7062b170eadafd78aa7c0104 /win | |
parent | 4964ea0ff919aca3e872155d323cd72868cb93f3 (diff) | |
download | tcl-ad739fa25ae937cd6dc5435db43f36c310d3a738.zip tcl-ad739fa25ae937cd6dc5435db43f36c310d3a738.tar.gz tcl-ad739fa25ae937cd6dc5435db43f36c310d3a738.tar.bz2 |
No [fconfigure -error] error in connect process; gets after failed async connect returns connect error
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinSock.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c index d8b9129..33eddd5 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1249,6 +1249,7 @@ CreateClientSocket( * Reset last error from last try */ infoPtr->lastError = 0; + Tcl_SetErrno(0); infoPtr->sockets->fd = socket(infoPtr->myaddr->ai_family, SOCK_STREAM, 0); @@ -1504,8 +1505,8 @@ WaitForConnect( return 1; } /* error case */ - *errorCodePtr = EFAULT; - return 1; + *errorCodePtr = Tcl_GetErrno(); + return 0; } /* Free list lock */ @@ -2417,15 +2418,23 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'e') && (strncmp(optionName, "-error", len) == 0)) { - int optlen; DWORD err; - int ret; - - optlen = sizeof(int); - ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR, - (char *)&err, &optlen); - if (ret == SOCKET_ERROR) { - err = WSAGetLastError(); + /* + * Check if an asyncroneous connect is running + * and return ok + */ + if (infoPtr->flags & SOCKET_REENTER_PENDING) { + err = 0; + } else { + int optlen; + int ret; + + optlen = sizeof(int); + ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR, + (char *)&err, &optlen); + if (ret == SOCKET_ERROR) { + err = WSAGetLastError(); + } } if (err) { TclWinConvertError(err); |