Skip to content
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: Readable().removeAllListeners() not work #20923

Closed
kaelzhang opened this issue May 24, 2018 · 1 comment
Closed

stream: Readable().removeAllListeners() not work #20923

kaelzhang opened this issue May 24, 2018 · 1 comment
Labels
confirmed-bug Issues with confirmed bugs.

Comments

@kaelzhang
Copy link
Contributor

  • Version: 10.1.0, 10.2.0, 11.0.0-pre
  • Platform: Darwin (), maybe all platforms
  • Subsystem:
const {Socket} = require('net')
const s = new Socket
s.on('data', () => {
})

s.removeAllListeners()
s.listenerCount('data') // 0 expected, but got 1

If there is no arguments for stream::removeAllListeners(), the argument to be passed into Stream.prototype.removeAllListeners will be undefined, see here

The undefined value causes that the events::removeAllListeners(undefined) will do nothing. see here

@apapirovski apapirovski added the confirmed-bug Issues with confirmed bugs. label May 24, 2018
@apapirovski
Copy link
Member

@kaelzhang Looks like a bug indeed. Feel free to open a PR if you would like or if not, hopefully someone else will.

kaelzhang added a commit to kaelzhang/node that referenced this issue May 24, 2018
MylesBorins pushed a commit that referenced this issue May 29, 2018
Fixes: #20923

PR-URL: #20924
Refs: #20923
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
patrickjuchli added a commit to patrickjuchli/basic-ftp that referenced this issue Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs.
Projects
None yet
Development

No branches or pull requests

2 participants