diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2018-12-19 14:14:57 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2018-12-28 12:57:46 -0800 |
commit | 00944c7cc25f391c3fbeba1e054a56a62cf0de12 (patch) | |
tree | ed5909000282156186e90a55c4a4696c628069c6 /lib/_tls_wrap.js | |
parent | 03e23a3d10ba66141ff32d668e02a6ce1cdb6b46 (diff) | |
download | android-node-v8-00944c7cc25f391c3fbeba1e054a56a62cf0de12.tar.gz android-node-v8-00944c7cc25f391c3fbeba1e054a56a62cf0de12.tar.bz2 android-node-v8-00944c7cc25f391c3fbeba1e054a56a62cf0de12.zip |
src: use consistent names for JSStream
Its confusing to call a js class with a handle a "Wrap", usually it's
the C++ handle that is called a Wrap (tcp_wrap, tls_wrap, ...). Its
derived from Socket, and makes a JS stream look like a Socket, so call
it that. Also, remove use of lib/_stream_wrap.js so it can be deprecated
some time.
PR-URL: https://github.com/nodejs/node/pull/25153
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 8 |
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()); } |