Skip to content

Commit

Permalink
dgram: remove usage of public require('util')
Browse files Browse the repository at this point in the history
Use `require('internal/util').deprecate` instead of
`require('util').deprecate`.

Refs: nodejs#26546

PR-URL: nodejs#26770
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
dnlup authored and targos committed Mar 27, 2019
1 parent 7f116c3 commit f9b18ad
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const {
} = require('internal/validators');
const { Buffer } = require('buffer');
const util = require('util');
const { deprecate } = require('internal/util');
const { isUint8Array } = require('internal/util/types');
const EventEmitter = require('events');
const {
Expand Down Expand Up @@ -728,61 +729,61 @@ Socket.prototype.getSendBufferSize = function() {

// Deprecated private APIs.
Object.defineProperty(Socket.prototype, '_handle', {
get: util.deprecate(function() {
get: deprecate(function() {
return this[kStateSymbol].handle;
}, 'Socket.prototype._handle is deprecated', 'DEP0112'),
set: util.deprecate(function(val) {
set: deprecate(function(val) {
this[kStateSymbol].handle = val;
}, 'Socket.prototype._handle is deprecated', 'DEP0112')
});


Object.defineProperty(Socket.prototype, '_receiving', {
get: util.deprecate(function() {
get: deprecate(function() {
return this[kStateSymbol].receiving;
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
set: util.deprecate(function(val) {
set: deprecate(function(val) {
this[kStateSymbol].receiving = val;
}, 'Socket.prototype._receiving is deprecated', 'DEP0112')
});


Object.defineProperty(Socket.prototype, '_bindState', {
get: util.deprecate(function() {
get: deprecate(function() {
return this[kStateSymbol].bindState;
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
set: util.deprecate(function(val) {
set: deprecate(function(val) {
this[kStateSymbol].bindState = val;
}, 'Socket.prototype._bindState is deprecated', 'DEP0112')
});


Object.defineProperty(Socket.prototype, '_queue', {
get: util.deprecate(function() {
get: deprecate(function() {
return this[kStateSymbol].queue;
}, 'Socket.prototype._queue is deprecated', 'DEP0112'),
set: util.deprecate(function(val) {
set: deprecate(function(val) {
this[kStateSymbol].queue = val;
}, 'Socket.prototype._queue is deprecated', 'DEP0112')
});


Object.defineProperty(Socket.prototype, '_reuseAddr', {
get: util.deprecate(function() {
get: deprecate(function() {
return this[kStateSymbol].reuseAddr;
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
set: util.deprecate(function(val) {
set: deprecate(function(val) {
this[kStateSymbol].reuseAddr = val;
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112')
});


Socket.prototype._healthCheck = util.deprecate(function() {
Socket.prototype._healthCheck = deprecate(function() {
healthCheck(this);
}, 'Socket.prototype._healthCheck() is deprecated', 'DEP0112');


Socket.prototype._stopReceiving = util.deprecate(function() {
Socket.prototype._stopReceiving = deprecate(function() {
stopReceiving(this);
}, 'Socket.prototype._stopReceiving() is deprecated', 'DEP0112');

Expand All @@ -796,7 +797,7 @@ Object.defineProperty(UDP.prototype, 'owner', {


module.exports = {
_createSocketHandle: util.deprecate(
_createSocketHandle: deprecate(
_createSocketHandle,
'dgram._createSocketHandle() is deprecated',
'DEP0112'
Expand Down

0 comments on commit f9b18ad

Please sign in to comment.