ECONNRESET must be treated like EOF; not like an error.
authorClaus Gittinger <cg@exept.de>
Sun, 01 Feb 2015 23:01:23 +0100
changeset 17360 24b114ab935a
parent 17359 61d90dff9c88
child 17361 ab3b25502ca4
ECONNRESET must be treated like EOF; not like an error.
ExternalStream.st
--- a/ExternalStream.st	Sun Feb 01 22:54:34 2015 +0100
+++ b/ExternalStream.st	Sun Feb 01 23:01:23 2015 +0100
@@ -5032,7 +5032,11 @@
 	    }
 
 	    __INST(position) = nil;
-	    if (ret < 0) {
+	    if ((ret < 0)
+#ifdef ECONNRESET
+		&& (__threadErrno != ECONNRESET)
+#endif
+	    ){
 		error = __mkSmallInteger(__threadErrno);
 	    } else /* ret == 0 */ {
 		__INST(hitEOF) = true;
@@ -5133,7 +5137,11 @@
 	    }
 
 	    __INST(position) = nil;
-	    if (ret < 0) {
+	    if ((ret < 0)
+#ifdef ECONNRESET
+		&& (__threadErrno != ECONNRESET)
+#endif
+	    ){
 		error = __mkSmallInteger(__threadErrno);
 	    } else /* ret == 0 */ {
 		__INST(hitEOF) = true;
@@ -5211,7 +5219,11 @@
 		}
 		RETURN ( __MKCHARACTER(c) );
 	    }
-	    if (ret < 0) {
+	    if ((ret < 0)
+#ifdef ECONNRESET
+		&& (__threadErrno != ECONNRESET)
+#endif
+	    ){
 		error = __mkSmallInteger(__threadErrno);
 	    } else /* ret == 0 */ {
 		__INST(hitEOF) = true;
@@ -5283,7 +5295,11 @@
 		}
 		RETURN ( __MKCHARACTER(c) );
 	    }
-	    if (ret < 0) {
+	    if ((ret < 0)
+#ifdef ECONNRESET
+		&& (__threadErrno != ECONNRESET)
+#endif
+	    ){
 		error = __mkSmallInteger(__threadErrno);
 	    } else /* ret == 0 */ {
 		__INST(hitEOF) = true;
@@ -5426,7 +5442,13 @@
 		__INST(hitEOF) = true;
 		RETURN (true);
 	    }
-
+#ifdef ECONNRESET
+	    // connection reset by peer is also an EOF
+	    if (__threadErrno == ECONNRESET) {
+		__INST(hitEOF) = true;
+		RETURN (true);
+	    }
+#endif
 	    /* ret < 0 */
 	    __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
 	}
@@ -6238,11 +6260,11 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.399 2015-01-27 14:50:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.400 2015-02-01 22:01:23 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.399 2015-01-27 14:50:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.400 2015-02-01 22:01:23 cg Exp $'
 ! !