From 41796ebd30744173cbe19201493349e7c8995082 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 28 May 2020 13:51:10 -0700 Subject: [PATCH] net: remove long deprecated server.connections property The server.connections property was runtime deprecated in the 0.9 days. It was replaced with getConnections(). It is not simply an alias for getConnections() because it fails to take connections shared with forks into consideration. Let's not keep it around forever and move it to end of life Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/33647 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ruben Bridgewater Reviewed-By: Matteo Collina --- doc/api/child_process.md | 5 +- doc/api/deprecations.md | 10 ++-- doc/api/net.md | 17 ------- doc/api/tls.md | 13 ------ lib/net.js | 16 ------- test/parallel/test-net-server-close.js | 28 +++-------- .../test-net-server-connections-child-null.js | 46 ------------------- test/parallel/test-net-server-connections.js | 39 ---------------- test/parallel/test-net-stream.js | 28 ++--------- test/parallel/test-net-sync-cork.js | 14 ++---- 10 files changed, 21 insertions(+), 195 deletions(-) delete mode 100644 test/parallel/test-net-server-connections-child-null.js delete mode 100644 test/parallel/test-net-server-connections.js diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 5657f2014ab7e4..2f18567737e66a 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1379,9 +1379,8 @@ process.on('message', (m, socket) => { ``` Once a socket has been passed to a child, the parent is no longer capable of -tracking when the socket is destroyed. To indicate this, the `.connections` -property becomes `null`. It is recommended not to use `.maxConnections` when -this occurs. +tracking when the socket is destroyed. It is recommended not to use +`.maxConnections` when this occurs. It is also recommended that any `'message'` handlers in the child process verify that `socket` exists, as the connection may have been closed during the diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 5df161c1c69344..1ee93d055bebc6 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -481,6 +481,9 @@ This behavior has been removed. ### DEP0020: `Server.connections` -Type: Runtime +Type: End-of-life -The [`Server.connections`][] property is deprecated. Please use the -[`Server.getConnections()`][] method instead. +The `Server.connections` property was deprecated in Node.js v0.9.7 and has +been removed. Please use the [`Server.getConnections()`][] method instead. ### DEP0021: `Server.listenFD` @@ -2759,7 +2762,6 @@ const moduleParents = Object.values(require.cache) [`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname [`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand [`ReadStream.open()`]: fs.html#fs_class_fs_readstream -[`Server.connections`]: net.html#net_server_connections [`Server.getConnections()`]: net.html#net_server_getconnections_callback [`Server.listen({fd: })`]: net.html#net_server_listen_handle_backlog_callback [`SlowBuffer`]: buffer.html#buffer_class_slowbuffer diff --git a/doc/api/net.md b/doc/api/net.md index 3e16d4a638f330..89b3de2f3b8471 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -156,22 +156,6 @@ The optional `callback` will be called once the `'close'` event occurs. Unlike that event, it will be called with an `Error` as its only argument if the server was not open when it was closed. -### `server.connections` - - -> Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. - -* {integer|null} - -The number of concurrent connections on the server. - -This becomes `null` when sending a socket to a child with -[`child_process.fork()`][]. To poll forks and get current number of active -connections, use asynchronous [`server.getConnections()`][] instead. - ### `server.getConnections(callback)` - -> Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. - -* {number} - -Returns the current number of concurrent connections on the server. - ### `server.getTicketKeys()`