From 9777890f5d9ce95f15c64d29f1c0a55c12d24c3e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 9 Oct 2013 17:46:17 +0200 Subject: [PATCH] tls: fix premature connection termination Destroying the TLS session implies destroying the underlying socket but before this commit, that was done with net.Socket#destroy() rather than net.Socket#destroySoon(). The former closes the connection right away, even when there is still data to write. In other words, sometimes the final TLS record got truncated. Fixes #6107. --- lib/tls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tls.js b/lib/tls.js index fe94a5121f..dcdd99a193 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -1400,7 +1400,7 @@ function pipe(pair, socket) { // Encrypted should be unpiped from socket to prevent possible // write after destroy. pair.encrypted.unpipe(socket); - socket.destroy(); + socket.destroySoon(); }); });