Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
test: fix tls-inception flakiness
Browse files Browse the repository at this point in the history
When sending a very large buffer (400000 bytes) the test fails due to
the client socket from the `a` server erroring with `ECONNRESET`.
There's a race condition between the closing of this socket and the `ssl`
socket closing on the other side of the connection. To improve things,
destroy the socket as soon as possible: in the `end` event of the `dest`
socket.

PR-URL: nodejs/node#4195
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
  • Loading branch information
santigimeno authored and indutny committed Dec 10, 2015
1 parent 86a3bd0 commit 3b94991
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-tls-inception.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var net = require('net');

var options, a, b;

var body = new Buffer(4000).fill('A');
var body = new Buffer(400000).fill('A');

options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
Expand All @@ -32,7 +32,7 @@ a = tls.createServer(options, function(socket) {
dest.pipe(socket);
socket.pipe(dest);

dest.on('close', function() {
dest.on('end', function() {
socket.destroy();
});
});
Expand Down

0 comments on commit 3b94991

Please sign in to comment.