From 6b68c099dcec8dad4f11644840998c709fd78dce Mon Sep 17 00:00:00 2001 From: jBarz Date: Sat, 18 Feb 2017 18:27:05 -0500 Subject: [PATCH] test: fix tls-inception flakiness cherry-picked the following from master commit 3b94991bda0922af09b00c2338f364d901678aad Author: Santiago Gimeno Date: Tue Dec 8 14:57:22 2015 +0100 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: https://github.com/nodejs/node/pull/4195 Reviewed-By: Brian White Reviewed-By: Fedor Indutny --- test/simple/test-tls-inception.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/simple/test-tls-inception.js b/test/simple/test-tls-inception.js index d15d1ebd43a7..8966bcefb388 100644 --- a/test/simple/test-tls-inception.js +++ b/test/simple/test-tls-inception.js @@ -49,6 +49,9 @@ a = tls.createServer(options, function (socket) { var dest = net.connect(options); dest.pipe(socket); socket.pipe(dest); + dest.on('end', function() { + socket.destroy(); + }); }); // the "target" server