-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
TCP socket won't call end() callback if wasn't connected #47322
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
Well, base Writable works as expected while Socket does not. So Socket violates its parent's behavior and thus makes impossible some flows dealing with generic streams. |
This comment was marked as outdated.
This comment was marked as outdated.
So, I don't think the behavior is too surprising. You're comparing What's more, the stream-y part of the socket is never activated; no data goes in or out. It would be more surprising IMO if the stream events did fire. |
But stream.Duplex does produce 'finish' and 'ended' output! |
The documentation for
And it has this to say on the callback argument:
But the socket never finishes (because it is never started) so I feel it's unsurprising that the callback isn't called. For the same reason it's unsurprising no That's my opinion. I'll keep this issue open for a few days and see if other maintainers feel differently. |
Based on a very quick look at this I think the callback should be called. I'll try to find time to dig into this. |
What happens here is the The IMO it's better to differentiate the cases of |
@jazelly That sounds like a correct analysis. PR welcome! |
Fixes: #47322 PR-URL: #47385 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
Version
v18.15.0
Platform
Win 8.1 x64
Subsystem
net
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
Expect at least 'ended' to show
What do you see instead?
nothing printed
Additional information
All streams seem to always call the callback from
end()
but non-connected sockets do not thus violatingstream.Writable
API.Why it is needed: I use universal function to close stream gracefully and when it's done call
destroy
. With this behavior the function stucks at non-connected sockets. Currently I seem to have to checkstream.writable
and only callend
when it's true.The text was updated successfully, but these errors were encountered: