-
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
Stream not emitting end after removeListener #9002
Comments
/cc @nodejs/streams |
hey @davedoesdev! What you describe is the currently intended behavior. Setting This is what is triggered: https://github.com/nodejs/node/blob/v6.7.0/lib/_stream_readable.js#L710-L713 What you want is to "undo" that scheduled There probably is a different bug about |
I have two separate bits of code (separate modules). One which reads a header from a stream and another which then reads the rest of the stream. The second bit of code when passed the stream (after the first has finished processing) then registers its own It's fine, I can get the second bit of code to check if the stream is already ended (using |
That is probably the best approach, yes. |
Thanks for the help @mcollina |
This program prints "END":
whereas this program does not:
The only difference is that a
readable
listener is added and then removed before the stream is ended.My question is whether the behaviour should be the same, given that there is no
readable
listener in both cases when the stream is ended.I can see in the code why: At https://github.com/nodejs/node/blob/v6.7.0/lib/_stream_readable.js#L696
readableListening
is set totrue
but it's never reset tofalse
if allreadable
listeners are removed.Before making any changes however, I'd like to ask whether this is intended behaviour?
The text was updated successfully, but these errors were encountered: