summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2009-04-27 21:36:33 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2009-04-27 21:36:33 (GMT)
commit9e2fbfa040b39731f29db2f5d79596099ef26489 (patch)
treee780be80beced9b577a40c34efa98c5326695b76
parent5c748fb724ab138c4b3d54155790eba84a44c464 (diff)
downloadtcl-9e2fbfa040b39731f29db2f5d79596099ef26489.zip
tcl-9e2fbfa040b39731f29db2f5d79596099ef26489.tar.gz
tcl-9e2fbfa040b39731f29db2f5d79596099ef26489.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 1e9c9c4..e4ec9ee 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-27 Donal K. Fellows <dkf@users.sf.net>
* doc/concat.n (EXAMPLES): [Bug 2780680]: Rewrote so that the spacing
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index ff94767..8e2612e 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.62 2008/02/22 11:50:54 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.62.2.1 2009/04/27 21:36:34 ferrieux Exp $
*/
#include "tclWinInt.h"
@@ -1574,11 +1574,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();