joyent/node — pull request #2490 by tricknotes (2012-01-08 16:37:48+00:00)
Title: events: Fix checking of max listeners

`EventEmitter.prototype.setMaxListeners` is broken.

```js
var EventEmitter = require('events').EventEmitter;
var ee = new EventEmitter();
ee.setMaxListeners(1);
ee.on('message', function() {});
ee.on('message', function() {}); // don't show warning against my expected.
ee.on('message', function() {}); // show warning.
```

`setMaxListeners` with another argument (ex. 5, 100, ...) shows warning correctly.

It seems to be broken for `setMaxListeners` called with `1`.

I fixed this issue by the way to check for max listeners after it set.

Thank you!