-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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' when sockets are not constructed #33818
Conversation
`OutgoingMessage#socket` is `null` for such cases at all times. Hence, we emit a 'close' event, imitating `destroyImpl.destroy`, without the socket operations. Fixes: nodejs#33653
Co-authored-by: James M Snell <jasnell@gmail.com>
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.
Are we emitting 'close'
if the stream finish normally?
@ronag wdyt?
@@ -296,6 +296,9 @@ OutgoingMessage.prototype.destroy = function destroy(error) { | |||
}); | |||
} | |||
|
|||
if (this instanceof OutgoingMessage) { |
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.
Why is this if
required?
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.
I added this to check for instances where no sockets were constructed, as in msg = new OutgoingMessage
(similar to the code snippet in the original issue #33653).
We should always emit a close, eventually... Though I don't think the implementation in this PR is correct. When we do get a socket Just so that I understand a bit better... the current code assumes that a socket will always was be assigned eventually... in which case is this false? The test is not a good example since it's never actually used like that. |
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.
I don't think this is correct, se above comment.
OutgoingMessage#socket
isnull
for such cases at all times.Hence, we emit a 'close' event, imitating
destroyImpl.destroy
,without the socket operations.
Fixes: #33653
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes