Skip to content
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

Merged
merged 4 commits into from Jul 28, 2018
Merged

dgram: clean up private APIs #21923

merged 4 commits into from Jul 28, 2018

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Jul 21, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@cjihrig cjihrig added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jul 21, 2018
Copy link
Member

@apapirovski apapirovski left a 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;
Copy link
Member

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,
};

@cjihrig cjihrig requested a review from a team July 23, 2018 15:00
lib/dgram.js Outdated
// Deprecated private APIs.
Object.defineProperty(Socket.prototype, '_handle', {
get: util.deprecate(function() {
console.log(this);
Copy link
Member

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?

Copy link
Contributor Author

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

@oyyd oyyd mentioned this pull request Jul 24, 2018
4 tasks
Copy link
Member

@mcollina mcollina left a 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.

@cjihrig cjihrig force-pushed the dgram branch 3 times, most recently from c189e0a to ec00636 Compare July 28, 2018 02:51
@cjihrig cjihrig removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Jul 28, 2018
@cjihrig
Copy link
Contributor Author

cjihrig commented Jul 28, 2018

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 <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
_createSocketHandle() is used internally by the cluster module.
This commit makes it internal only API.

PR-URL: nodejs#21923
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit makes all previously private APIs available via
getters, setters, and wrapper functions.

PR-URL: nodejs#21923
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@cjihrig
Copy link
Contributor Author

cjihrig commented Jul 28, 2018

Landed in d497ebb, 79e41cc, 3f6ee75, and 045b07d.

@cjihrig cjihrig deleted the dgram branch July 28, 2018 04:36
targos pushed a commit that referenced this pull request Jul 31, 2018
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 <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2018
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 <apapirovski@mac.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2018
_createSocketHandle() is used internally by the cluster module.
This commit makes it internal only API.

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>
targos pushed a commit that referenced this pull request Jul 31, 2018
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>
@targos targos mentioned this pull request Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants