mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
dgram: add getters/setters for private APIs
This commit makes all previously private APIs available via getters, setters, and wrapper functions. PR-URL: https://github.com/nodejs/node/pull/21923 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
62
lib/dgram.js
62
lib/dgram.js
@@ -684,7 +684,69 @@ Socket.prototype.getSendBufferSize = function() {
|
||||
};
|
||||
|
||||
|
||||
// Legacy private APIs to be deprecated in the future.
|
||||
Object.defineProperty(Socket.prototype, '_handle', {
|
||||
get() {
|
||||
return this[kStateSymbol].handle;
|
||||
},
|
||||
set(val) {
|
||||
this[kStateSymbol].handle = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Object.defineProperty(Socket.prototype, '_receiving', {
|
||||
get() {
|
||||
return this[kStateSymbol].receiving;
|
||||
},
|
||||
set(val) {
|
||||
this[kStateSymbol].receiving = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Object.defineProperty(Socket.prototype, '_bindState', {
|
||||
get() {
|
||||
return this[kStateSymbol].bindState;
|
||||
},
|
||||
set(val) {
|
||||
this[kStateSymbol].bindState = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Object.defineProperty(Socket.prototype, '_queue', {
|
||||
get() {
|
||||
return this[kStateSymbol].queue;
|
||||
},
|
||||
set(val) {
|
||||
this[kStateSymbol].queue = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Object.defineProperty(Socket.prototype, '_reuseAddr', {
|
||||
get() {
|
||||
return this[kStateSymbol].reuseAddr;
|
||||
},
|
||||
set(val) {
|
||||
this[kStateSymbol].reuseAddr = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Socket.prototype._healthCheck = function() {
|
||||
healthCheck(this);
|
||||
};
|
||||
|
||||
|
||||
Socket.prototype._stopReceiving = function() {
|
||||
stopReceiving(this);
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
_createSocketHandle,
|
||||
createSocket,
|
||||
Socket
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user