Skip to content

net: emit close on unconnected socket - #29803

Closed
ronag wants to merge 2 commits into
nodejs:masterfrom
nxtedition:fix-net-destroy-close
Closed

net: emit close on unconnected socket#29803
ronag wants to merge 2 commits into
nodejs:masterfrom
nxtedition:fix-net-destroy-close

Conversation

@ronag

@ronagronag commented Oct 1, 2019

Copy link
Copy Markdown
Member

Socket should always emit 'close'. Regardless whether it has been connected or not.

Probably a minor fix for an edge case.

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

@nodejs-github-botnodejs-github-bot added the net Issues and PRs related to the net subsystem. label Oct 1, 2019
Socket should always emit 'close'. Regardless
whether it has been connected or not.
@ronag
ronagforce-pushed the fix-net-destroy-close branch from 39e179b to 2b81112CompareOctober 1, 2019 18:22

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a minor fix for an edge case.

I agree.

Comment threadlib/net.js
process.nextTick(emitCloseNT, this);
}

cb(exception);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this moving this into the individual branches of the if matter, if emitCloseNT is delayed by a tick anyway?

@ronagronagOct 1, 2019

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax: yes, if the user inside the callback wants to schedule something before 'close' using a nextTick.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm very close the edge on the edge case on this one :)

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 3, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadtest/parallel/test-net-connect-destroy.js Outdated
@TrottTrott removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 3, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Trott pushed a commit that referenced this pull request Oct 3, 2019
Socket should always emit 'close'. Regardless
whether it has been connected or not.
PR-URL: #29803
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
@Trott

Trott commented Oct 3, 2019

Copy link
Copy Markdown
Member

Landed in a57da27

@TrottTrott closed this Oct 3, 2019
BridgeAR pushed a commit that referenced this pull request Oct 9, 2019
Socket should always emit 'close'. Regardless
whether it has been connected or not.
PR-URL: #29803
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
@BridgeARBridgeAR mentioned this pull request Oct 10, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

netIssues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ronag@nodejs-github-bot@Trott@addaleax@JungMinu@BridgeAR@trivikr