summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2009-04-27 21:25:17 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2009-04-27 21:25:17 (GMT)
commit67f8b1bc1ba1d7df58f6005534a2f488a100c339 (patch)
tree08153556a85dbd59d13dd57e65bd1071abae6a37
parentdfec115d39b5adbfc1ab38de1b52a06cb052831a (diff)
downloadtcl-67f8b1bc1ba1d7df58f6005534a2f488a100c339.zip
tcl-67f8b1bc1ba1d7df58f6005534a2f488a100c339.tar.gz
tcl-67f8b1bc1ba1d7df58f6005534a2f488a100c339.tar.bz2
Backport fix for [Bug 2446662]: resync Win behavior on RST with that of unix (EOF).
-rw-r--r--ChangeLog5
-rw-r--r--win/tclWinSock.c16
2 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 12f4ef3..6addf27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-27 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * win/tclWinSock.c: Backport fix for [Bug 2446662]: resync Win
+ behavior on RST with that of unix (EOF).
+
2009-04-22 Andreas Kupries <andreask@activestate.com>
* generic/tclStringObj.c (UpdateStringOfString): Added cast to fix
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index eb1ee84..1053d4d 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.36.2.8 2007/11/29 00:31:51 hobbs Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.36.2.9 2009/04/27 21:25:18 ferrieux Exp $
*/
#include "tclWinInt.h"
@@ -1769,11 +1769,23 @@ TcpInputProc(instanceData, buf, toRead, errorCodePtr)
break;
}
+ error = winSock.WSAGetLastError();
+
+ /*
+ * If an RST comes, then ignore the error and report an EOF just like
+ * on unix.
+ */
+
+ if (error == WSAECONNRESET) {
+ infoPtr->flags |= SOCKET_EOF;
+ bytesRead = 0;
+ break;
+ }
+
/*
* Check for error condition or underflow in non-blocking case.
*/
- error = winSock.WSAGetLastError();
if ((infoPtr->flags & SOCKET_ASYNC) || (error != WSAEWOULDBLOCK)) {
TclWinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();