Skip to content

Commit

Permalink
dgram: add getters/setters for private APIs
Browse files Browse the repository at this point in the history
This commit makes all previously private APIs available via
getters, setters, and wrapper functions.

PR-URL: #21923
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Wyatt Preul <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
cjihrig committed Jul 28, 2018
1 parent 3f6ee75 commit 045b07d
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,69 @@ Socket.prototype.getSendBufferSize = function() {
};


// Legacy private APIs to be deprecated in the future.
Object.defineProperty(Socket.prototype, '_handle', {
get() {
return this[kStateSymbol].handle;
},
set(val) {
this[kStateSymbol].handle = val;
}
});


Object.defineProperty(Socket.prototype, '_receiving', {
get() {
return this[kStateSymbol].receiving;
},
set(val) {
this[kStateSymbol].receiving = val;
}
});


Object.defineProperty(Socket.prototype, '_bindState', {
get() {
return this[kStateSymbol].bindState;
},
set(val) {
this[kStateSymbol].bindState = val;
}
});


Object.defineProperty(Socket.prototype, '_queue', {
get() {
return this[kStateSymbol].queue;
},
set(val) {
this[kStateSymbol].queue = val;
}
});


Object.defineProperty(Socket.prototype, '_reuseAddr', {
get() {
return this[kStateSymbol].reuseAddr;
},
set(val) {
this[kStateSymbol].reuseAddr = val;
}
});


Socket.prototype._healthCheck = function() {
healthCheck(this);
};


Socket.prototype._stopReceiving = function() {
stopReceiving(this);
};


module.exports = {
_createSocketHandle,
createSocket,
Socket
};

0 comments on commit 045b07d

Please sign in to comment.