Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
net: don't suppress ECONNRESET
Browse files Browse the repository at this point in the history
Let ECONNRESET network errors bubble up so clients can detect them.

Commit c4454d2 suppressed and turned them into regular end-of-stream
events to fix the then-failing simple/test-regress-GH-1531 test. See
also issue #1571 for (scant) details.

It turns out that special handling is no longer necessary. Remove the
special casing and let the error bubble up naturally.

pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack
are updated because they expected an EPIPE error code that is now an
ECONNRESET. Suppression of the ECONNRESET prevented the test from
detecting that the connection has been severed whereupon the next
write would fail with an EPIPE.

Fixes #1776.
  • Loading branch information
bnoordhuis committed Jan 31, 2013
1 parent 0168109 commit f84a4c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions lib/net.js
Expand Up @@ -505,11 +505,7 @@ function onread(buffer, offset, length) {
} else {
debug('error', errno);
// Error
if (errno == 'ECONNRESET') {
self._destroy();
} else {
self._destroy(errnoException(errno, 'read'));
}
self._destroy(errnoException(errno, 'read'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-https-ci-reneg-attack.js
Expand Up @@ -89,7 +89,7 @@ function test(next) {

var closed = false;
child.stdin.on('error', function(err) {
assert.equal(err.code, 'EPIPE');
assert.equal(err.code, 'ECONNRESET');
closed = true;
});
child.stdin.on('close', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-tls-ci-reneg-attack.js
Expand Up @@ -87,7 +87,7 @@ function test(next) {

var closed = false;
child.stdin.on('error', function(err) {
assert.equal(err.code, 'EPIPE');
assert.equal(err.code, 'ECONNRESET');
closed = true;
});
child.stdin.on('close', function() {
Expand Down

0 comments on commit f84a4c6

Please sign in to comment.