|
23 | 23 |
|
24 | 24 | const EventEmitter = require('events');
|
25 | 25 | const stream = require('stream');
|
26 |
| -const util = require('util'); |
27 |
| -const internalUtil = require('internal/util'); |
| 26 | +const { inspect } = require('internal/util/inspect'); |
| 27 | +const debug = require('internal/util/debuglog').debuglog('net'); |
| 28 | +const { deprecate } = require('internal/util'); |
28 | 29 | const {
|
29 | 30 | isIP,
|
30 | 31 | isIPv4,
|
@@ -130,8 +131,6 @@ function getNewAsyncId(handle) {
|
130 | 131 | }
|
131 | 132 |
|
132 | 133 |
|
133 |
| -const debug = util.debuglog('net'); |
134 |
| - |
135 | 134 | function isPipeName(s) {
|
136 | 135 | return typeof s === 'string' && toNumber(s) === false;
|
137 | 136 | }
|
@@ -335,7 +334,8 @@ function Socket(options) {
|
335 | 334 | this[kBytesRead] = 0;
|
336 | 335 | this[kBytesWritten] = 0;
|
337 | 336 | }
|
338 |
| -util.inherits(Socket, stream.Duplex); |
| 337 | +Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype); |
| 338 | +Object.setPrototypeOf(Socket, stream.Duplex); |
339 | 339 |
|
340 | 340 | // Refresh existing timeouts.
|
341 | 341 | Socket.prototype._unrefTimer = function _unrefTimer() {
|
@@ -1094,17 +1094,17 @@ function Server(options, connectionListener) {
|
1094 | 1094 | this._connections = 0;
|
1095 | 1095 |
|
1096 | 1096 | Object.defineProperty(this, 'connections', {
|
1097 |
| - get: internalUtil.deprecate(() => { |
| 1097 | + get: deprecate(() => { |
1098 | 1098 |
|
1099 | 1099 | if (this._usingWorkers) {
|
1100 | 1100 | return null;
|
1101 | 1101 | }
|
1102 | 1102 | return this._connections;
|
1103 | 1103 | }, 'Server.connections property is deprecated. ' +
|
1104 | 1104 | 'Use Server.getConnections method instead.', 'DEP0020'),
|
1105 |
| - set: internalUtil.deprecate((val) => (this._connections = val), |
1106 |
| - 'Server.connections property is deprecated.', |
1107 |
| - 'DEP0020'), |
| 1105 | + set: deprecate((val) => (this._connections = val), |
| 1106 | + 'Server.connections property is deprecated.', |
| 1107 | + 'DEP0020'), |
1108 | 1108 | configurable: true, enumerable: false
|
1109 | 1109 | });
|
1110 | 1110 |
|
@@ -1406,7 +1406,7 @@ Server.prototype.listen = function(...args) {
|
1406 | 1406 | 'must have the property "port" or "path"');
|
1407 | 1407 | }
|
1408 | 1408 |
|
1409 |
| - throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options)); |
| 1409 | + throw new ERR_INVALID_OPT_VALUE('options', inspect(options)); |
1410 | 1410 | };
|
1411 | 1411 |
|
1412 | 1412 | function lookupAndListen(self, port, address, backlog, exclusive, flags) {
|
@@ -1590,10 +1590,10 @@ Object.defineProperty(Socket.prototype, '_handle', {
|
1590 | 1590 | });
|
1591 | 1591 |
|
1592 | 1592 |
|
1593 |
| -Server.prototype.listenFD = internalUtil.deprecate(function(fd, type) { |
| 1593 | +Server.prototype.listenFD = deprecate(function(fd, type) { |
1594 | 1594 | return this.listen({ fd: fd });
|
1595 | 1595 | }, 'Server.listenFD is deprecated. Use Server.listen({fd: <number>}) instead.',
|
1596 |
| - 'DEP0021'); |
| 1596 | + 'DEP0021'); |
1597 | 1597 |
|
1598 | 1598 | Server.prototype._setupWorker = function(socketList) {
|
1599 | 1599 | this._usingWorkers = true;
|
|
0 commit comments