diff --git a/lib/tls.js b/lib/tls.js index 53859121733..8650041c91f 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -1322,6 +1322,12 @@ function pipe(pair, socket) { pair.encrypted.pipe(socket); socket.pipe(pair.encrypted); + pair.encrypted.on('close', function() { + process.nextTick(function() { + socket.destroy(); + }); + }); + pair.fd = socket.fd; var cleartext = pair.cleartext; cleartext.socket = socket;