Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
addaleax committed Nov 10, 2018
commit c58bced696227902a182de88b128963eb600c108
6 changes: 4 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,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());
Comment thread
oyyd marked this conversation as resolved.
}

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