★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/0f6a9524f8Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

tls: destroy TLS socket if StreamWrap is destroyed

Previously, there was no mechanism in place that would
have destroyed the TLS socket once the underlying socket
had been closed.

PR-URL: #24290
Refs: #24288
Refs: #24075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
  • Loading branch information...
addaleax authored and codebytere committed Nov 10, 2018
1 parent 0c73221 commit 0f6a9524f82ca435ae5c53dfc580b7b37dbf9913
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/_tls_wrap.js
@@ -310,10 +310,12 @@ function TLSSocket(socket, opts) {

// Wrap plain JS Stream into StreamWrap
var wrap;
if ((socket instanceof net.Socket && socket._handle) || !socket)
if ((socket instanceof net.Socket && socket._handle) || !socket) {
wrap = socket;
else
} else {
wrap = new StreamWrap(socket);
wrap.once('close', () => this.destroy());
}

// Just a documented property to make secure sockets
// distinguishable from regular ones.

0 comments on commit 0f6a952

Please sign in to comment.
You can’t perform that action at this time.