diff options
author | stanton <stanton@noemail.net> | 1999-02-03 00:51:18 (GMT) |
---|---|---|
committer | stanton <stanton@noemail.net> | 1999-02-03 00:51:18 (GMT) |
commit | f05e03b57ab09399d626770ff1d471f8d5a4a074 (patch) | |
tree | 046fb0eda048d3c0c480c5401841aeb295469df9 /win/tclWinSock.c | |
parent | 31b414eb0c3f2c33e40d1bc512f5f66184f17654 (diff) | |
download | tcl-f05e03b57ab09399d626770ff1d471f8d5a4a074.zip tcl-f05e03b57ab09399d626770ff1d471f8d5a4a074.tar.gz tcl-f05e03b57ab09399d626770ff1d471f8d5a4a074.tar.bz2 |
* unix/tclUnixChan.c:
* win/tclWinSock.c:
* doc/socket.n: Applied Gordon Chaffee's patch to handle failures
during asynchronous socket connection operations. This adds a new
"-error" fconfgure option to socket channels. [Bug: 893]
FossilOrigin-Name: dd5a31ec232186d4ee8f5c99dbec2f1db5bc7a83
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r-- | win/tclWinSock.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 00e7f22..a8f2a2f 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.4 1998/12/04 01:01:55 stanton Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.5 1999/02/03 00:51:20 stanton Exp $ */ #include "tclInt.h" @@ -699,7 +699,7 @@ SocketEventProc(evPtr, flags) } } - if (events & FD_WRITE) { + if (events & (FD_WRITE | FD_CONNECT)) { mask |= TCL_WRITABLE; } @@ -1741,6 +1741,24 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr) len = strlen(optionName); } + if ((len > 1) && (optionName[1] == 'e') && + (strncmp(optionName, "-error", len) == 0)) { + int optlen; + int err, ret; + + optlen = sizeof(int); + ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR, + (char *)&err, &optlen); + if (ret == SOCKET_ERROR) { + err = (*winSock.WSAGetLastError)(); + } + if (err) { + TclWinConvertWSAError(err); + Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1); + } + return TCL_OK; + } + if ((len == 0) || ((len > 1) && (optionName[1] == 'p') && (strncmp(optionName, "-peername", len) == 0))) { @@ -1868,7 +1886,7 @@ TcpWatchProc(instanceData, mask) infoPtr->watchEvents |= (FD_READ|FD_CLOSE|FD_ACCEPT); } if (mask & TCL_WRITABLE) { - infoPtr->watchEvents |= (FD_WRITE); + infoPtr->watchEvents |= (FD_WRITE|FD_CONNECT); } /* |