summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-03-07 12:22:36 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-10 00:46:54 +0100
commite7f58868b5ea1312f7bac4f152f4d928b64e0202 (patch)
treee06a734c0302b86fca764a34f9325b8032261d5d /lib/net.js
parent3414bc7b25a00556af80c6ba946e28464e7e8d36 (diff)
downloadandroid-node-v8-e7f58868b5ea1312f7bac4f152f4d928b64e0202.tar.gz
android-node-v8-e7f58868b5ea1312f7bac4f152f4d928b64e0202.tar.bz2
android-node-v8-e7f58868b5ea1312f7bac4f152f4d928b64e0202.zip
net: use kHandle symbol for accessing native handle
Use a common `kHandle` for all `StreamBase`-based streams. PR-URL: https://github.com/nodejs/node/pull/26491 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/net.js b/lib/net.js
index 2cb03b927f..8d69cbaf81 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -58,11 +58,11 @@ const {
symbols: { async_id_symbol, owner_symbol }
} = require('internal/async_hooks');
const {
- createWriteWrap,
writevGeneric,
writeGeneric,
onStreamRead,
kAfterAsyncWrite,
+ kHandle,
kUpdateTimer,
setStreamTimeout
} = require('internal/stream_base_commons');
@@ -233,7 +233,7 @@ function Socket(options) {
// probably be supplied by async_hooks.
this[async_id_symbol] = -1;
this._hadError = false;
- this._handle = null;
+ this[kHandle] = null;
this._parent = null;
this._host = null;
this[kLastWriteQueueSize] = 0;
@@ -689,11 +689,11 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
this._unrefTimer();
- var req = createWriteWrap(this._handle);
+ let req;
if (writev)
- writevGeneric(this, req, data, cb);
+ req = writevGeneric(this, data, cb);
else
- writeGeneric(this, req, data, encoding, cb);
+ req = writeGeneric(this, data, encoding, cb);
if (req.async)
this[kLastWriteQueueSize] = req.bytes;
};
@@ -1584,6 +1584,11 @@ Object.defineProperty(TCP.prototype, 'owner', {
set(v) { return this[owner_symbol] = v; }
});
+Object.defineProperty(Socket.prototype, '_handle', {
+ get() { return this[kHandle]; },
+ set(v) { return this[kHandle] = v; }
+});
+
Server.prototype.listenFD = internalUtil.deprecate(function(fd, type) {
return this.listen({ fd: fd });