summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index b07812f1a6..a72091b22e 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -29,7 +29,7 @@ const net = require('net');
const tls = require('tls');
const util = require('util');
const common = require('_tls_common');
-const { StreamWrap } = require('_stream_wrap');
+const JSStreamSocket = require('internal/js_stream_socket');
const { Buffer } = require('buffer');
const debug = util.debuglog('tls');
const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap');
@@ -310,12 +310,14 @@ function TLSSocket(socket, opts) {
this.authorizationError = null;
this[kRes] = null;
- // Wrap plain JS Stream into StreamWrap
var wrap;
if ((socket instanceof net.Socket && socket._handle) || !socket) {
wrap = socket;
} else {
- wrap = new StreamWrap(socket);
+ // TLS expects to interact from C++ with a net.Socket that has a C++ stream
+ // handle, but a JS stream doesn't have one. Wrap it up to make it look like
+ // a socket.
+ wrap = new JSStreamSocket(socket);
wrap.once('close', () => this.destroy());
}