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

src: extract common DoBind and DoConnect methods #22315

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
9 participants
@maclover7
Copy link
Member

maclover7 commented Aug 14, 2018

TCPWrap::Bind and TCPWrap::Bind6 share a large amount of functionality, so a common DoBind was extracted to remove duplication. TCPWrap::Connect/TCPWrap::Connect6 follow this same pattern, so DoConnect was extracted from those two methods to also remove duplication.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
@jasnell

This comment has been minimized.

Copy link
Member

jasnell commented Aug 14, 2018

The change looks fine but can you include a quick description of the rationale in the commit log and PR description?

@maclover7 maclover7 force-pushed the maclover7:jm-extract-tcp branch from c37fb12 to c2dad9b Aug 14, 2018

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Aug 16, 2018

@BridgeAR BridgeAR requested a review from addaleax Aug 17, 2018

@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Aug 19, 2018

@joyeecheung

This comment has been minimized.

Copy link
Member

joyeecheung commented Aug 20, 2018

This PR needs a rebase against master to avoid the git failure in the CI.

@joyeecheung joyeecheung referenced this pull request Aug 20, 2018

Closed

CI failures: 20180820 #15

@addaleax addaleax removed the author ready label Aug 25, 2018

@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Aug 25, 2018

@maclover7 Can you rebase?

@jasnell

This comment has been minimized.

Copy link
Member

jasnell commented Sep 10, 2018

Ping @maclover7

@Trott Trott referenced this pull request Nov 15, 2018

Closed

Bangalore, November 17th #88

@maclover7 maclover7 force-pushed the maclover7:jm-extract-tcp branch 2 times, most recently from 9482b0e to 0697900 Nov 29, 2018

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Nov 29, 2018

@addaleax @jasnell Rebased — sorry for my delay

src: extract common Bind method
`TCPWrap::Bind` and `TCPWrap::Bind6` share a large amount of
functionality, so a common `Bind` was extracted to remove duplication.
@addaleax
Copy link
Member

addaleax left a comment

Still LGTM

@maclover7

This comment has been minimized.

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Dec 3, 2018

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Dec 3, 2018

Could use another review or two @nodejs/collaborators

@indutny

indutny approved these changes Dec 3, 2018

Copy link
Member

indutny left a comment

LGTM if CI is happy. Thanks!

sockaddr_in addr;
int err = uv_ip4_addr(*ip_address, port, &addr);
if (family == AF_INET6 &&
!args[2]->Uint32Value(env->context()).To(&flags)) return;

This comment has been minimized.

@indutny

indutny Dec 3, 2018

Member

Does this pass lint? I'd rather put return on a next line and add braces on this line and the line after return.

@ronkorving

This comment has been minimized.

Copy link
Contributor

ronkorving commented Dec 5, 2018

I have to share a somewhat amusing observation that while the intention of this PR is to reduce code (redundancy), GitHub measures it to remove as many lines as it adds (+23 −23).

While I can appreciate the sentiment, I see this as increasing complexity in order to remove code duplication, shrinking the code base by 0 lines.

-0 on this one.

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Dec 17, 2018

@Trott Trott added the author ready label Dec 17, 2018

@maclover7

This comment has been minimized.

Copy link
Member

maclover7 commented Dec 17, 2018

Landed in 4b96a2a

@maclover7 maclover7 closed this Dec 17, 2018

@maclover7 maclover7 deleted the maclover7:jm-extract-tcp branch Dec 17, 2018

maclover7 added a commit that referenced this pull request Dec 17, 2018

src: extract common Bind method
`TCPWrap::Bind` and `TCPWrap::Bind6` share a large amount of
functionality, so a common `Bind` was extracted to remove duplication.

PR-URL: #22315
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>

MylesBorins added a commit that referenced this pull request Dec 25, 2018

src: extract common Bind method
`TCPWrap::Bind` and `TCPWrap::Bind6` share a large amount of
functionality, so a common `Bind` was extracted to remove duplication.

PR-URL: #22315
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>

@MylesBorins MylesBorins referenced this pull request Dec 25, 2018

Merged

v11.6.0 proposal #25175

refack added a commit to refack/node that referenced this pull request Jan 14, 2019

src: extract common Bind method
`TCPWrap::Bind` and `TCPWrap::Bind6` share a large amount of
functionality, so a common `Bind` was extracted to remove duplication.

PR-URL: nodejs#22315
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment