dgram: deprecate all previous private APIs
PR-URL: https://github.com/nodejs/node/pull/22011 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
0b85435c01
commit
fe069cca6a
@ -1009,6 +1009,18 @@ Type: Documentation-only
|
|||||||
The `process.binding()` API is intended for use by Node.js internal code
|
The `process.binding()` API is intended for use by Node.js internal code
|
||||||
only. Use of `process.binding()` by userland code is unsupported.
|
only. Use of `process.binding()` by userland code is unsupported.
|
||||||
|
|
||||||
|
<a id="DEP0112"></a>
|
||||||
|
### DEP0112: dgram private APIs
|
||||||
|
|
||||||
|
Type: Runtime
|
||||||
|
|
||||||
|
The `dgram` module previously contained several APIs that were never meant to
|
||||||
|
accessed outside of Node.js core: `Socket.prototype._handle`,
|
||||||
|
`Socket.prototype._receiving`, `Socket.prototype._bindState`,
|
||||||
|
`Socket.prototype._queue`, `Socket.prototype._reuseAddr`,
|
||||||
|
`Socket.prototype._healthCheck()`, `Socket.prototype._stopReceiving()`, and
|
||||||
|
`dgram._createSocketHandle()`.
|
||||||
|
|
||||||
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
|
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
|
||||||
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
|
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
|
||||||
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
|
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
|
||||||
|
54
lib/dgram.js
54
lib/dgram.js
@ -737,65 +737,65 @@ Socket.prototype.getSendBufferSize = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Legacy private APIs to be deprecated in the future.
|
// Deprecated private APIs.
|
||||||
Object.defineProperty(Socket.prototype, '_handle', {
|
Object.defineProperty(Socket.prototype, '_handle', {
|
||||||
get() {
|
get: util.deprecate(function() {
|
||||||
return this[kStateSymbol].handle;
|
return this[kStateSymbol].handle;
|
||||||
},
|
}, 'Socket.prototype._handle is deprecated', 'DEP0112'),
|
||||||
set(val) {
|
set: util.deprecate(function(val) {
|
||||||
this[kStateSymbol].handle = val;
|
this[kStateSymbol].handle = val;
|
||||||
}
|
}, 'Socket.prototype._handle is deprecated', 'DEP0112')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperty(Socket.prototype, '_receiving', {
|
Object.defineProperty(Socket.prototype, '_receiving', {
|
||||||
get() {
|
get: util.deprecate(function() {
|
||||||
return this[kStateSymbol].receiving;
|
return this[kStateSymbol].receiving;
|
||||||
},
|
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
|
||||||
set(val) {
|
set: util.deprecate(function(val) {
|
||||||
this[kStateSymbol].receiving = val;
|
this[kStateSymbol].receiving = val;
|
||||||
}
|
}, 'Socket.prototype._receiving is deprecated', 'DEP0112')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperty(Socket.prototype, '_bindState', {
|
Object.defineProperty(Socket.prototype, '_bindState', {
|
||||||
get() {
|
get: util.deprecate(function() {
|
||||||
return this[kStateSymbol].bindState;
|
return this[kStateSymbol].bindState;
|
||||||
},
|
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
|
||||||
set(val) {
|
set: util.deprecate(function(val) {
|
||||||
this[kStateSymbol].bindState = val;
|
this[kStateSymbol].bindState = val;
|
||||||
}
|
}, 'Socket.prototype._bindState is deprecated', 'DEP0112')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperty(Socket.prototype, '_queue', {
|
Object.defineProperty(Socket.prototype, '_queue', {
|
||||||
get() {
|
get: util.deprecate(function() {
|
||||||
return this[kStateSymbol].queue;
|
return this[kStateSymbol].queue;
|
||||||
},
|
}, 'Socket.prototype._queue is deprecated', 'DEP0112'),
|
||||||
set(val) {
|
set: util.deprecate(function(val) {
|
||||||
this[kStateSymbol].queue = val;
|
this[kStateSymbol].queue = val;
|
||||||
}
|
}, 'Socket.prototype._queue is deprecated', 'DEP0112')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperty(Socket.prototype, '_reuseAddr', {
|
Object.defineProperty(Socket.prototype, '_reuseAddr', {
|
||||||
get() {
|
get: util.deprecate(function() {
|
||||||
return this[kStateSymbol].reuseAddr;
|
return this[kStateSymbol].reuseAddr;
|
||||||
},
|
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
|
||||||
set(val) {
|
set: util.deprecate(function(val) {
|
||||||
this[kStateSymbol].reuseAddr = val;
|
this[kStateSymbol].reuseAddr = val;
|
||||||
}
|
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Socket.prototype._healthCheck = function() {
|
Socket.prototype._healthCheck = util.deprecate(function() {
|
||||||
healthCheck(this);
|
healthCheck(this);
|
||||||
};
|
}, 'Socket.prototype._healthCheck() is deprecated', 'DEP0112');
|
||||||
|
|
||||||
|
|
||||||
Socket.prototype._stopReceiving = function() {
|
Socket.prototype._stopReceiving = util.deprecate(function() {
|
||||||
stopReceiving(this);
|
stopReceiving(this);
|
||||||
};
|
}, 'Socket.prototype._stopReceiving() is deprecated', 'DEP0112');
|
||||||
|
|
||||||
|
|
||||||
// Legacy alias on the C++ wrapper object. This is not public API, so we may
|
// Legacy alias on the C++ wrapper object. This is not public API, so we may
|
||||||
@ -807,7 +807,11 @@ Object.defineProperty(UDP.prototype, 'owner', {
|
|||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
_createSocketHandle: util.deprecate(
|
||||||
_createSocketHandle,
|
_createSocketHandle,
|
||||||
|
'dgram._createSocketHandle() is deprecated',
|
||||||
|
'DEP0112'
|
||||||
|
),
|
||||||
createSocket,
|
createSocket,
|
||||||
Socket
|
Socket
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user