net: make _setSimultaneousAccepts() end-of-life deprecated
PR-URL: https://github.com/nodejs/node/pull/57550 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
13a9d4c160
commit
ace5548ff0
@ -2554,12 +2554,15 @@ undocumented `COUNTER_NET_SERVER_CONNECTION()`,
|
||||
|
||||
<!-- YAML
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/57550
|
||||
description: End-of-Life.
|
||||
- version: v12.0.0
|
||||
pr-url: https://github.com/nodejs/node/pull/23760
|
||||
description: Runtime deprecation.
|
||||
-->
|
||||
|
||||
Type: Runtime
|
||||
Type: End-of-Life
|
||||
|
||||
The undocumented `net._setSimultaneousAccepts()` function was originally
|
||||
intended for debugging and performance tuning when using the
|
||||
|
39
lib/net.js
39
lib/net.js
@ -2473,48 +2473,9 @@ Server.prototype.unref = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
let _setSimultaneousAccepts;
|
||||
let warnSimultaneousAccepts = true;
|
||||
|
||||
if (isWindows) {
|
||||
let simultaneousAccepts;
|
||||
|
||||
_setSimultaneousAccepts = function(handle) {
|
||||
if (warnSimultaneousAccepts) {
|
||||
process.emitWarning(
|
||||
'net._setSimultaneousAccepts() is deprecated and will be removed.',
|
||||
'DeprecationWarning', 'DEP0121');
|
||||
warnSimultaneousAccepts = false;
|
||||
}
|
||||
if (handle === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (simultaneousAccepts === undefined) {
|
||||
simultaneousAccepts = (process.env.NODE_MANY_ACCEPTS &&
|
||||
process.env.NODE_MANY_ACCEPTS !== '0');
|
||||
}
|
||||
|
||||
if (handle._simultaneousAccepts !== simultaneousAccepts) {
|
||||
handle.setSimultaneousAccepts(!!simultaneousAccepts);
|
||||
handle._simultaneousAccepts = simultaneousAccepts;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
_setSimultaneousAccepts = function() {
|
||||
if (warnSimultaneousAccepts) {
|
||||
process.emitWarning(
|
||||
'net._setSimultaneousAccepts() is deprecated and will be removed.',
|
||||
'DeprecationWarning', 'DEP0121');
|
||||
warnSimultaneousAccepts = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
_createServerHandle: createServerHandle,
|
||||
_normalizeArgs: normalizeArgs,
|
||||
_setSimultaneousAccepts,
|
||||
get BlockList() {
|
||||
BlockList ??= require('internal/blocklist').BlockList;
|
||||
return BlockList;
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Flags: --no-warnings
|
||||
'use strict';
|
||||
|
||||
// Test that DEP0121 is emitted on the first call of _setSimultaneousAccepts().
|
||||
|
||||
const {
|
||||
expectWarning
|
||||
} = require('../common');
|
||||
const {
|
||||
_setSimultaneousAccepts
|
||||
} = require('net');
|
||||
|
||||
expectWarning(
|
||||
'DeprecationWarning',
|
||||
'net._setSimultaneousAccepts() is deprecated and will be removed.',
|
||||
'DEP0121');
|
||||
|
||||
_setSimultaneousAccepts();
|
@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Test that DEP0121 is emitted only once if _setSimultaneousAccepts() is called
|
||||
// more than once. This test is similar to
|
||||
// test-net-deprecated-setsimultaneousaccepts.js, but that test calls
|
||||
// _setSimultaneousAccepts() only once. Unlike this test, that will confirm
|
||||
// that the warning is emitted on the first call. This test doesn't check which
|
||||
// call caused the warning to be emitted.
|
||||
|
||||
const { expectWarning } = require('../common');
|
||||
const { _setSimultaneousAccepts } = require('net');
|
||||
|
||||
expectWarning(
|
||||
'DeprecationWarning',
|
||||
'net._setSimultaneousAccepts() is deprecated and will be removed.',
|
||||
'DEP0121');
|
||||
|
||||
_setSimultaneousAccepts();
|
||||
_setSimultaneousAccepts();
|
Loading…
x
Reference in New Issue
Block a user