diff options
author | max <max@tclers.tk> | 2013-11-12 11:45:04 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2013-11-12 11:45:04 (GMT) |
commit | 498d86acd9ca0d9d7bc004c1c14c19dc332b77a3 (patch) | |
tree | ae8b95a0f6db9a3169098a1ff72849daf385b087 /unix/tclUnixSock.c | |
parent | 1aafdd134e0b8454e83bc659eeb7f7dd2c5b2006 (diff) | |
download | tcl-498d86acd9ca0d9d7bc004c1c14c19dc332b77a3.zip tcl-498d86acd9ca0d9d7bc004c1c14c19dc332b77a3.tar.gz tcl-498d86acd9ca0d9d7bc004c1c14c19dc332b77a3.tar.bz2 |
Fix [5425f2c082]: [fconfigure -error] breaks the background processing of a pending [socket -async].
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r-- | unix/tclUnixSock.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index a6360c2..7ef28d8 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -737,7 +737,10 @@ TcpGetOptionProc( if (statePtr->status == 0) { ret = getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR, - (char *) &err, &optlen); + (char *) &err, &optlen); + if (statePtr->flags & TCP_ASYNC_CONNECT) { + statePtr->status = err; + } if (ret < 0) { err = errno; } @@ -1054,12 +1057,17 @@ CreateClientSocket( */ optlen = sizeof(int); - getsockopt(state->fds.fd, SOL_SOCKET, SO_ERROR, - (char *) &status, &optlen); - state->status = status; + + if (state->status == 0) { + getsockopt(state->fds.fd, SOL_SOCKET, SO_ERROR, + (char *) &status, &optlen); + state->status = status; + } else { + status = state->status; + state->status = 0; + } } if (status == 0) { - CLEAR_BITS(state->flags, TCP_ASYNC_CONNECT); goto out; } } @@ -1067,6 +1075,7 @@ CreateClientSocket( out: + CLEAR_BITS(state->flags, TCP_ASYNC_CONNECT); if (async_callback) { /* * An asynchonous connection has finally succeeded or failed. |