When a readable listener is added, call read(0) so that data will flow in, up to the high water mark. Otherwise, it's somewhat confusing that you have to listen for readable, and ALSO call read() (when it will certainly return null) just to get some data out of the stream. See: #4720
A typo in the variable name makes it throw a ReferenceError instead of the expected "Unknown type" error when dns.resolve() is passed a bad record type argument. Fixes the following exception: ReferenceError: type is not defined at Object.exports.resolve (dns.js:189:40) at /Users/bnoordhuis/src/master/test/simple/test-c-ares.js:48:9 <snip>
Calling end(data) calls write(data). Doing this after end should raise a 'write after end' error. However, because end() calls were previously ignored on already ended streams, this error was confusingly suppressed, even though the data never is written, and cannot get to the other side. This is a re-hash of 5222d19, but without assuming that the data passed to end() is valid, and thus breaking a bunch of tests.
It's breaking ~22 tests, Needs further investigation. This reverts commit 5222d19.
Calling end(data) calls write(data). Doing this after end should raise a 'write after end' error. However, because end() calls were previously ignored on already ended streams, this error was confusingly suppressed, even though the data never is written, and cannot get to the other side.
Don't use hard-coded port numbers, use common.PORT instead. Should fix the occasional Jenkins failure; the builds run in parallel.
The stock writable stream "write after end" message is overly vague, if you have clearly not called end() yourself yet. When we receive a FIN from the other side, and call destroySoon() as a result, then generate an EPIPE error (which is what would happen if you did actually write to the socket), with a message explaining what actually happened.
By making sure the _events is always an object there is one less check that needs to be performed by emit. Use undefined instead of null. typeof checks are a lot faster than isArray. There are a few places where the this._events check cannot be removed because it is possible for the user to call those methods after using utils.extend to create their own EventEmitter, but before it has actually been instantiated.
setMaxListeners will now make sure a positive number is passed. Also throwing more definitive Error types.
Remove the assert() that triggered when Cipher#final() or Decipher#final() was called twice. Fixes #4886.