summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2013-03-17tls: write pending data of opposite sideFedor Indutny
Fix stucked CryptoStream behaviour, happening when one of the sides locks-up in queued state. fix #5023
2013-03-14stream: Return self from readable.wrapisaacs
Also, set paused=false *before* calling resume(). Otherwise, there's an edge case where an immediately-emitted chunk might make it call pause() again incorrectly.
2013-03-14stream: Never call decoder.end() multiple timesGil Pedersen
Updated version that does what it says without assigning state.decoder.
2013-03-14http: Don't hot-path end() for large buffersisaacs
The benefits of the hot-path optimization below start to fall off when the buffer size gets up near 128KB, because the cost of the copy is more than the cost of the extra write() call. Switch to the write/end method at that point. Heuristics and magic numbers are awful, but slow http responses are worse. Fix #4975
2013-03-14net: improve arbitrary tcp socket supportBen Noordhuis
Consider this example: // fd 3 is a bound tcp socket var s = net.createServer(cb); s.listen({ fd: 3 }); console.log(s.address()); // prints null This commit makes net.Server#address() print the actual address. Ditto for non-listen sockets; properties like net.Socket#localAddress and net.Socket#remoteAddress now return the correct value. Fixes #5009.
2013-03-14deps: upgrade libuv to 7b66ea1Ben Noordhuis
2013-03-13Revert "stream: Never call decoder.end() multiple times"isaacs
This reverts commit 615d809ac684a7d2cc7ee5e1aa58f0a921b529a0.
2013-03-13fs: Missing cb errors are deprecated, not a throwisaacs
Commit a804347 makes fs function rethrow errors when the callback is omitted. While the right thing to do, it's a change from the old v0.8 behavior where such errors were silently ignored. To give users time to upgrade, temporarily disable that and replace it with a function that warns once about the deprecated behavior. Close #5005
2013-03-13stream: Never call decoder.end() multiple timesGil Pedersen
Fixes decoder.end() being called on every push(null). As the tls module does this, corrupt stream data could potentially be added to the end.
2013-03-13net: handle 'finish' event only after 'connect'Fedor Indutny
2013-03-10stream: Don't emit 'end' unless read() calledisaacs
This solves the problem of calling `readable.pipe(writable)` after the readable stream has already emitted 'end', as often is the case when writing simple HTTP proxies. The spirit of streams2 is that things will work properly, even if you don't set them up right away on the first tick. This approach breaks down, however, because pipe()ing from an ended readable will just do nothing. No more data will ever arrive, and the writable will hang open forever never being ended. However, that does not solve the case of adding a `on('end')` listener after the stream has received the EOF chunk, if it was the first chunk received (and thus, length was 0, and 'end' got emitted). So, with this, we defer the 'end' event emission until the read() function is called. Also, in pipe(), if the source has emitted 'end' already, we call the cleanup/onend function on nextTick. Piping from an already-ended stream is thus the same as piping from a stream that is in the process of ending. Updates many tests that were relying on 'end' coming immediately, even though they never read() from the req. Fix #4942
2013-03-10stream: Avoid nextTick warning filling read bufferisaacs
In the function that pre-emptively fills the Readable queue, it relies on a recursion through: stream.push(chunk) -> maybeReadMore(stream, state) -> if (not reading more and < hwm) stream.read(0) -> stream._read() -> stream.push(chunk) -> repeat. Since this was only calling read() a single time, and then relying on a future nextTick to collect more data, it ends up causing a nextTick recursion error (and potentially a RangeError, even) if you have a very high highWaterMark, and are getting very small chunks pushed synchronously in _read (as happens with TLS, or many simple test streams). This change implements a new approach, so that read(0) is called repeatedly as long as it is effective (that is, the length keeps increasing), and thus quickly fills up the buffer for streams such as these, without any stacks overflowing.
2013-03-10events: Handle missing error obj when domains in useJulian Gruber
so `ee.emit('error')` doesn't throw when domains are active create an empty error only when handled by a domain test for when no error is provided to an error event
2013-03-10http: ServerRequest does not timeout after 'end'koichik
Fixes #4967
2013-03-10http: Do not setTimeout a not-yet-existent socketisaacs
Fixes #4967
2013-03-09http: check if incoming parser has already been freedhc
Fix #4948 This adds a check before setting the incoming parser to null. Under certain circumstances it'll already be set to null by freeParser(). Otherwise this will cause node to crash as it tries to set null on something that is already null.
2013-03-09timers: consistent this keyword in setImmediateAndreas Madsen
When calling setImmediate with extra arguments the this keyword in the callback would refer to the global object, but when not calling setImmediate with extra arguments this would refer to the returned handle object. This commit fixes that inconsistency so its always set handle object. The handle object was chosen for performance reasons.
2013-03-08stream: Always defer preemptive reading to improve latencyGil Pedersen
2013-03-08zlib: Manage flush flags appropriatelyisaacs
If you call z.flush();z.write('foo'); then it would try to write 'foo' before the flush was done, triggering an assertion in the zlib binding. Closes #4950
2013-03-08Revert "http: check if incoming parser has already been freed"isaacs
This reverts commit 9f4c3b0d45f858d3d3021ef4b8edebf6005008ff.
2013-03-08http: check if incoming parser has already been freedhheennrryy@gmail.com
Fix #4948 This adds a check before setting the incoming parser to null. Under certain circumstances it'll already be set to null by freeParser(). Otherwise this will cause node to crash as it tries to set null on something that is already null.
2013-03-08stream: Emit error on stream object, not globalisaacs
Apparently this function got abstracted out at some point, and 'this' wasn't changed to the correct object.
2013-03-07child_process: support sending dgram socketAndreas Madsen
child.send can send net servers and sockets. Now that we have support for dgram clusters this functionality should be extended to include dgram sockets.
2013-03-06http: More useful setTimeout API on serverisaacs
This adds the following to HTTP: * server.setTimeout(msecs, callback) Sets all new connections to time out after the specified time, at which point it emits 'timeout' on the server, passing the socket as an argument. In this way, timeouts can be handled in one place consistently. * req.setTimeout(), res.setTimeout() Essentially an alias to req/res.socket.setTimeout(), but without having to delve into a "buried" object. Adds a listener on the req/res object, but not on the socket. * server.timeout Number of milliseconds before incoming connections time out. (Default=1000*60*2, as before.) Furthermore, if the user sets up their own timeout listener on either the server, the request, or the response, then the default behavior (destroying the socket) is suppressed. Fix #3460
2013-03-06stream: Raise readable high water mark in powers of 2isaacs
This prevents excessively raising the buffer level in tiny increments in pathological cases.
2013-03-06stream: Allow strings in Readable.push/unshiftisaacs
Fix #4909
2013-03-06stream: Remove bufferSize optionisaacs
Now that highWaterMark increases when there are large reads, this greatly reduces the number of calls necessary to _read(size), assuming that _read actually respects the size argument.
2013-03-06stream: Remove pipeOpts.chunkSizeisaacs
It's not actually necessary for backwards compatibility, isn't used anywhere, and isn't even tested. Better to just remove it.
2013-03-06stream: Increase highWaterMark on large readsisaacs
If the consumer of a Readable is asking for N bytes, and N > hwm, then clearly we have set the hwm to low, and ought to increase it. Fix #4931
2013-03-06stream: Remove unnecessary nextTick usage in Writableisaacs
Fix #4928
2013-03-06node: Add --throw-deprecationisaacs
Extremely handy when tracking down a flood of recursive nextTick warnings.
2013-03-06http: fix multiple timeout eventsEugene Girshov
Fixed up slightly by @isaacs so as not to miss 'timeout' events in some cases.
2013-03-06net: use close callback, not process.nextTickBen Noordhuis
Don't emit the 'close' event with process.nextTick. Closing a handle is an operation that usually *but not always* completes on the next tick of the event loop, hence using process.nextTick is not reliable. Use a proper handle close callback and emit the 'close' event from inside the callback. Update tests that depend on the intricacies of the old model. Fixes #3459.
2013-03-06DNS: Support NAPTR queriesPavel Lang
They were previously removed in a90bc78534d94940a6b726c01cf8427c296b4c63.
2013-03-05child_process: handle ENOENT correctly on WindowsScott Blomquist
2013-03-05stream: Use class for write buffer entriesisaacs
2013-03-05stream: _write takes an encoding argumentisaacs
This vastly reduces the overhead of decodeStrings:false streams, such as net and http.
2013-03-05stream: Remove output function from _transformisaacs
Just use stream.push(outputChunk) instead.
2013-03-05stream: Split Writable logic into small functionsisaacs
1. Get rid of unnecessary 'finishing' flag 2. Dont check both ending and ended. Extraneous. Also: Remove extraneous 'finishing' flag, and don't check both 'ending' and 'ended', since checking just 'ending' is sufficient.
2013-03-05Merge remote-tracking branch 'origin/v0.8'Ben Noordhuis
2013-03-05cluster: propagate bind errorsBen Noordhuis
This commit fixes a bug where the cluster module fails to propagate EADDRINUSE errors. When a worker starts a (net, http) server, it requests the listen socket from its master who then creates and binds the socket. Now, OS X and Windows don't always signal EADDRINUSE from bind() but instead defer the error until a later syscall. libuv mimics this behaviour to provide consistent behaviour across platforms but that means the worker could end up with a socket that is not actually bound to the requested addresss. That's why the worker now checks if the socket is bound, raising EADDRINUSE if that's not the case. Fixes #2721.
2013-03-05events: loop backwards in removeListenerFelix Böhm
`removeAllListeners` is removing events from end to start. Therefore it spends O(n^2) time, since `removeListener` is searching from start to end.
2013-03-04events: code consistencyTrevor Norris
v8 likes when smaller functions have a single return point, and cleaned up the single non-strict check.
2013-03-04events: remove type check for event typeTrevor Norris
Strict checking for typeof types broke backwards compatibility for other libraries. This reverts those checks. The subclass test has been changed to ensure all operations can be performed on the inherited EE before instantiation. Including the ability to set event names with numbers.
2013-03-04stream: Don't require read(0) to emit 'readable' eventisaacs
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
2013-03-04dns: fix ReferenceError in resolve() error pathXidorn Quan
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>
2013-03-03cluster: Rename destroy() to kill(signal=SIGTERM)isaacs
Fix #4133, bringing the cluster worker API more in line with the child process API.
2013-03-03stream: Writable.end(chunk) after end is an errorisaacs
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 5222d19a11ed0e29d207da0e8c9c8e0e3b18ad78, but without assuming that the data passed to end() is valid, and thus breaking a bunch of tests.
2013-03-03make repl compatible with domainsDave Olszewski
The try/catch in repl.js keeps any active domain from catching the error. Since the domain may not even be enterd until the code is run, it's not possible to avoid the try/catch, so emit on the domain when an error is thrown.
2013-03-03Revert "stream: Writable.end(chunk) after end is an error"Ben Noordhuis
It's breaking ~22 tests, Needs further investigation. This reverts commit 5222d19a11ed0e29d207da0e8c9c8e0e3b18ad78.