Skip to content

Commit 3b94991

Browse files
santigimenoindutny
authored andcommitted
test: fix tls-inception flakiness
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: #4195 Reviewed-By: Brian White <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 86a3bd0 commit 3b94991

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/parallel/test-tls-inception.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var net = require('net');
1414

1515
var options, a, b;
1616

17-
var body = new Buffer(4000).fill('A');
17+
var body = new Buffer(400000).fill('A');
1818

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

35-
dest.on('close', function() {
35+
dest.on('end', function() {
3636
socket.destroy();
3737
});
3838
});

0 commit comments

Comments
 (0)