-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
net: check for close on stream, not parent #25026
Conversation
'close' event isn't emitted on a TLS connection if it's been written to (but 'end' and 'finish' events are). Fixes: #24984
@@ -371,8 +371,8 @@ Socket.prototype._final = function(cb) { | |||
}; | |||
|
|||
|
|||
function afterShutdown(status, 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.
Do you know why this gets called with the wrong 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 comes from here: https://github.com/nodejs/node/blob/v11.4.0/src/stream_base.cc#L383
This in turn is set by https://github.com/nodejs/node/blob/v11.4.0/src/stream_base-inl.h#L86
which is called by https://github.com/nodejs/node/blob/v11.4.0/src/tls_wrap.cc#L73
TLSWrap
's stream
is the external stream from here: https://github.com/nodejs/node/blob/v11.4.0/lib/_tls_wrap.js#L423
which is the unencrypted socket passed into the constructor: https://github.com/nodejs/node/blob/v11.4.0/lib/_tls_wrap.js#311
In summary, it gets the underlying socket's stream rather than the encrypted stream (TLSSocket
). Node stream operations appear to be performed on TLSSocket
only.
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.
Thanks for the explanation.
Re-run of CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1694/ |
Do I need to do anything about the CITGM? They look like compile failures. |
Landed in 86e2ec4. |
'close' event isn't emitted on a TLS connection if it's been written to (but 'end' and 'finish' events are). PR-URL: nodejs#25026 Fixes: nodejs#24984 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
'close' event isn't emitted on a TLS connection if it's been written to (but 'end' and 'finish' events are). PR-URL: nodejs#25026 Fixes: nodejs#24984 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
afterShutdown
was checking parent stream rather than TLS streamFixes #24984
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes