summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-03-11 13:35:37 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-03-11 13:35:37 (GMT)
commit66cf21eaafc70136b89e7ea52f24a1373e8cd3f4 (patch)
treeed68c0436ceb2bbf7062b170eadafd78aa7c0104 /win/tclWinSock.c
parentca31b05c9d550db49feff41e523fd9262c362308 (diff)
downloadtcl-66cf21eaafc70136b89e7ea52f24a1373e8cd3f4.zip
tcl-66cf21eaafc70136b89e7ea52f24a1373e8cd3f4.tar.gz
tcl-66cf21eaafc70136b89e7ea52f24a1373e8cd3f4.tar.bz2
No [fconfigure -error] error in connect process; gets after failed async connect returns connect error
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c29
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);