-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dgram: clean up private APIs #21923
dgram: clean up private APIs #21923
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with 1 nit.
lib/dgram.js
Outdated
this._receiving = false; | ||
this._bindState = BIND_STATE_UNBOUND; | ||
this[async_id_symbol] = this._handle.getAsyncId(); | ||
state.handle = handle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit cleaner if these were all declared directly on the state
object. Meaning:
const state = {
handle,
receiving: false,
...etc,
};
lib/dgram.js
Outdated
// Deprecated private APIs. | ||
Object.defineProperty(Socket.prototype, '_handle', { | ||
get: util.deprecate(function() { | ||
console.log(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the console.log(this)
added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I forgot to remove it facepalm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with @jasnell nit.
c189e0a
to
ec00636
Compare
Addressed nits. Backed out the deprecations, and instead added getters/setters so that the PR is no longer semver-major. I'm going to open a follow up semver-major PR that reimplements the deprecations only. For now, this shouldn't cause problems for other PRs. CI: https://ci.nodejs.org/job/node-test-pull-request/16043/ EDIT: CI was green |
These methods are private APIs of dgram sockets, but do not need to be exposed via the Socket prototype. PR-URL: nodejs#21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
dgram sockets have a fair number of exposed private properties. This commit hides them all behind a single symbol property. PR-URL: nodejs#21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_createSocketHandle() is used internally by the cluster module. This commit makes it internal only API. PR-URL: nodejs#21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
This commit makes all previously private APIs available via getters, setters, and wrapper functions. PR-URL: nodejs#21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
These methods are private APIs of dgram sockets, but do not need to be exposed via the Socket prototype. PR-URL: #21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
dgram sockets have a fair number of exposed private properties. This commit hides them all behind a single symbol property. PR-URL: #21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_createSocketHandle() is used internally by the cluster module. This commit makes it internal only API. PR-URL: #21923 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Wyatt Preul <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
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]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes