-
Notifications
You must be signed in to change notification settings - Fork 30k
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
http - emit close last #15588
http - emit close last #15588
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 but it needs a test.
@mcollina I vaguely remember you having a similar PR a while back? Can you take a look? |
I think this is ok, but it needs a test and a CITGM run. We should probably also verify manually if |
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.
needs a test
Ping @ronag |
@ronag I pushed a commit with a test to your branch so we can move this forward. Hope you don't mind. |
assert.strictEqual(err.constructor, Error); | ||
assert.strictEqual(err.message, 'socket hang up'); | ||
assert.strictEqual(err.code, 'ECONNRESET'); | ||
req.on('close', common.mustCall(() => server.close())); |
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.
Moving the req.on('close' ...
line out of the req.on('error' ...
would make this slightly better. Then just add a boolean that is set in on('error')
and checked in on('close')
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.
Done.
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. pinging @mcollina for another review.
Ping @mcollina |
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 CI and CITGM green:
https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1011/
CI failures look unrelated. |
@refack can you please check CITGM output? |
CITGM should be green (as far as I understand it). Let me land. |
Out of pure prudence, I'm flagging this as dont-land-on-X and as "baking-for-lts". I would like to have this in 9 for a while before having it in 8 or lower. |
Landed as 5d99a9b |
Emit close event after all other events in the client, e.g. error will be emitted before close. PR-URL: #15588 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@ronag Congrats on landing your first commit in Node.js core and becoming a Contributor! |
Emit close event after all other events in the client, e.g. error will be emitted before close. PR-URL: nodejs/node#15588 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Emit close event after all other events in the client, e.g. error will be emitted before close. PR-URL: nodejs/node#15588 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@mcollina should we consider this for 8.x? |
no, this should not be backportes |
Emit
close
event after all other events.Refs: #15270