diff --git a/lib/net.js b/lib/net.js index ecf7258e8bb37f..b5025abb9e1ef3 100644 --- a/lib/net.js +++ b/lib/net.js @@ -23,7 +23,8 @@ const EventEmitter = require('events'); const stream = require('stream'); -const util = require('util'); +const { inspect } = require('internal/util/inspect'); +const { debuglog } = require('internal/util/debuglog'); const internalUtil = require('internal/util'); const { isIP, @@ -130,7 +131,7 @@ function getNewAsyncId(handle) { } -const debug = util.debuglog('net'); +const debug = debuglog('net'); function isPipeName(s) { return typeof s === 'string' && toNumber(s) === false; @@ -335,7 +336,8 @@ function Socket(options) { this[kBytesRead] = 0; this[kBytesWritten] = 0; } -util.inherits(Socket, stream.Duplex); +Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype); +Object.setPrototypeOf(Socket, stream.Duplex); // Refresh existing timeouts. Socket.prototype._unrefTimer = function _unrefTimer() { @@ -1411,7 +1413,7 @@ Server.prototype.listen = function(...args) { 'must have the property "port" or "path"'); } - throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options)); + throw new ERR_INVALID_OPT_VALUE('options', inspect(options)); }; function lookupAndListen(self, port, address, backlog, exclusive, flags) {