summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2009-01-26 22:57:48 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2009-01-26 22:57:48 (GMT)
commitf8cf7d1c32e40ccd4a7f2e27de0a51b5196aa00b (patch)
tree5118ceff009667095a8093b38fa81ae255c74204
parent8752714aa15af36681d96e5b8f017aabb9e81d23 (diff)
downloadtcl-f8cf7d1c32e40ccd4a7f2e27de0a51b5196aa00b.zip
tcl-f8cf7d1c32e40ccd4a7f2e27de0a51b5196aa00b.tar.gz
tcl-f8cf7d1c32e40ccd4a7f2e27de0a51b5196aa00b.tar.bz2
Fix [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 22488c2..77bcb0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-26 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * win/tclWinSocl.c: Fix [Bug 2446662]: resync Win behavior on RST
+ with that of unix (EOF).
+
2009-01-26 Donal K. Fellows <dkf@users.sf.net>
* generic/tclZlib.c (ChanClose): Only generate error messages in the
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 9f5b9bc..d99ee2d 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.64 2008/12/18 01:14:17 ferrieux Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.65 2009/01/26 22:57:57 ferrieux Exp $
*/
#include "tclWinInt.h"
@@ -1627,11 +1627,23 @@ TcpInputProc(
break;
}
+ error = 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 = WSAGetLastError();
if ((infoPtr->flags & SOCKET_ASYNC) || (error != WSAEWOULDBLOCK)) {
TclWinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();