Tcl Source Code

Artifact [fdcff52517]
Login

Artifact fdcff52517e53747cba0f663dd579867ae77dc0c:

Attachment "rst.patch" to ticket [2446662fff] added by ferrieux 2009-04-28 05:13:19.
Index: tclWinSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSock.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- tclWinSock.c	18 Dec 2008 01:14:17 -0000	1.64
+++ tclWinSock.c	26 Jan 2009 22:57:57 -0000	1.65
@@ -1627,11 +1627,23 @@
 	    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();