summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-04-08 15:15:31 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-04-08 15:15:31 (GMT)
commitbf345d6be59f6f513be07b6465487f137b9ac820 (patch)
treec9774c286331aea79bbded211e1544c764870cc4 /win
parent207329f22a7bf020db137dc4e6d9b9b82d7a4f67 (diff)
downloadtcl-bf345d6be59f6f513be07b6465487f137b9ac820.zip
tcl-bf345d6be59f6f513be07b6465487f137b9ac820.tar.gz
tcl-bf345d6be59f6f513be07b6465487f137b9ac820.tar.bz2
Beautify check for async connect reentry
Diffstat (limited to 'win')
-rw-r--r--win/tclWinSock.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index dc67c4b..de4c519 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -595,8 +595,7 @@ WaitForConnect(
* return the error ENOTCONN
*/
- if ( errorCodePtr != NULL &&
- (statePtr->flags & TCP_ASYNC_FAILED) ) {
+ if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) {
*errorCodePtr = ENOTCONN;
return -1;
}
@@ -605,8 +604,9 @@ WaitForConnect(
* Check if an async connect is running. If not return ok
*/
- if ( !(statePtr->flags & TCP_ASYNC_PENDING) )
+ if (!(statePtr->flags & TCP_ASYNC_CONNECT)) {
return 0;
+ }
/*
* Be sure to disable event servicing so we are truly modal.
@@ -1635,7 +1635,7 @@ TcpConnect(
*/
int async_connect = statePtr->flags & TCP_ASYNC_CONNECT;
/* We were called by the event procedure and continue our loop */
- int async_callback = statePtr->sockets->fd != INVALID_SOCKET;
+ int async_callback = statePtr->flags & TCP_ASYNC_PENDING;
ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
if (async_callback) {
@@ -1811,6 +1811,12 @@ out:
* Socket connected or connection failed
*/
+ /*
+ * Async connect terminated
+ */
+
+ CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT);
+
if ( Tcl_GetErrno() == 0 ) {
/*
* Succesfully connected