Skip to content

Commit 40fedd3

Browse files
cjihrigtargos
authored andcommitted
dgram: add getters/setters for private APIs
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]>
1 parent 98ef8cf commit 40fedd3

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

lib/dgram.js

+62
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,69 @@ Socket.prototype.getSendBufferSize = function() {
684684
};
685685

686686

687+
// Legacy private APIs to be deprecated in the future.
688+
Object.defineProperty(Socket.prototype, '_handle', {
689+
get() {
690+
return this[kStateSymbol].handle;
691+
},
692+
set(val) {
693+
this[kStateSymbol].handle = val;
694+
}
695+
});
696+
697+
698+
Object.defineProperty(Socket.prototype, '_receiving', {
699+
get() {
700+
return this[kStateSymbol].receiving;
701+
},
702+
set(val) {
703+
this[kStateSymbol].receiving = val;
704+
}
705+
});
706+
707+
708+
Object.defineProperty(Socket.prototype, '_bindState', {
709+
get() {
710+
return this[kStateSymbol].bindState;
711+
},
712+
set(val) {
713+
this[kStateSymbol].bindState = val;
714+
}
715+
});
716+
717+
718+
Object.defineProperty(Socket.prototype, '_queue', {
719+
get() {
720+
return this[kStateSymbol].queue;
721+
},
722+
set(val) {
723+
this[kStateSymbol].queue = val;
724+
}
725+
});
726+
727+
728+
Object.defineProperty(Socket.prototype, '_reuseAddr', {
729+
get() {
730+
return this[kStateSymbol].reuseAddr;
731+
},
732+
set(val) {
733+
this[kStateSymbol].reuseAddr = val;
734+
}
735+
});
736+
737+
738+
Socket.prototype._healthCheck = function() {
739+
healthCheck(this);
740+
};
741+
742+
743+
Socket.prototype._stopReceiving = function() {
744+
stopReceiving(this);
745+
};
746+
747+
687748
module.exports = {
749+
_createSocketHandle,
688750
createSocket,
689751
Socket
690752
};

0 commit comments

Comments
 (0)