Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 40fedd3

Browse filesBrowse 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 <apapirovski@mac.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 98ef8cf commit 40fedd3
Copy full SHA for 40fedd3

File tree

Expand file treeCollapse file tree

1 file changed

+62
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+62
-0
lines changed
Open diff view settings
Collapse file

‎lib/dgram.js‎

Copy file name to clipboardExpand all lines: lib/dgram.js
+62Lines changed: 62 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.