Commit Graph
2146 Commits
Author SHA1 Message Date
isaacs 04541cf7bc streams2: Emit pause/resume events 2012-12-14 10:52:29 -08:00
isaacs 8fe7b0c910 streams2: Support a Readable hwm of 0
Necessary for proper stdin functioning
2012-12-14 10:52:29 -08:00
isaacs 5760244cc6 streams2: Writable only emit 'finish' once 2012-12-14 10:52:28 -08:00
isaacs 8f428f3b0d streams2: Call read(0) on resume()
Otherwise (especially with stdin) you sometimes end up in cases
where the high water mark is zero, and the current buffer is at 0,
and it doesn't need a readable event, so it never calls _read().
2012-12-14 10:52:28 -08:00
isaacs fc7d8d59f7 lint 2012-12-14 10:52:28 -08:00
isaacs dbcacc5afe streams2: NextTick the emit('readable') in resume()
Otherwise resume() will cause data to be emitted before it can be handled.
2012-12-14 10:52:28 -08:00
isaacs 99021b7a4f streams2: pause() should be immediate 2012-12-14 10:52:28 -08:00
isaacs 42981e2aad streams2: Switch to old-mode immediately, not nextTick
This fixes the CONNECT/Upgrade HTTP functionality, which was not getting
sliced properly, because readable wasn't emitted on this tick.

Conflicts:

	test/simple/test-http-connect.js
2012-12-14 10:52:28 -08:00
isaacs 83704f1279 streams2: Set readable=false on end 2012-12-14 10:52:27 -08:00
isaacs dd3ebb8cf6 crypto: Streaming interface for Sign and Verify 2012-12-14 10:52:27 -08:00
isaacs e336134658 crypto: Streaming interface for cipher/decipher/iv 2012-12-14 10:52:27 -08:00
isaacs 175f78c6ba crypto: Streaming api for Hmac 2012-12-14 10:52:27 -08:00
isaacs 90de2ddb77 crypto: Streaming interface for Hash 2012-12-14 10:52:26 -08:00
isaacs 0e01d6398f zlib: streams2 2012-12-14 10:52:26 -08:00
isaacs 44b308b1f7 fs: streams2 2012-12-14 10:52:26 -08:00
isaacs d58f2654bc streams2: Unpipe on dest.emit('close') 2012-12-13 17:00:34 -08:00
isaacs 49ea653363 streams2: Remove pipe if the dest emits error 2012-12-13 17:00:34 -08:00
isaacs ac5a185edf streams2: Handle pipeChunkSize properly 2012-12-13 17:00:33 -08:00
isaacs 53fa66d9f7 streams2: Set 'readable' flag on Readable streams 2012-12-13 17:00:33 -08:00
isaacs 4b4ff2dff1 streams2: Refactor out .once() usage from Readable.pipe() 2012-12-13 17:00:33 -08:00
isaacs 38e2b0053a streams2: Get rid of .once() usage in Readable.pipe
Significant performance impact
2012-12-13 17:00:33 -08:00
isaacs b15e19a232 streams2: Remove function.bind() usage
It's too slow, unfortunately.
2012-12-13 17:00:32 -08:00
isaacs 2ff499c022 streams2: Do multipipe without always using forEach
The Array.forEach call is too expensive.
2012-12-13 17:00:32 -08:00
isaacs 0118584433 streams2: Writable organization, add 'finishing' flag 2012-12-13 17:00:31 -08:00
isaacs 286c54439a streams2: Only emit 'readable' when needed 2012-12-13 17:00:31 -08:00
isaacs 62dd04027b streams2: Set Readable lwm to 0 by default 2012-12-13 17:00:31 -08:00
isaacs f20fd22abd streams2: Add high water mark for Readable
Also, organize the numeric settings a bit on the ReadableState class
2012-12-13 17:00:30 -08:00
isaacs 63ac07b32b streams2: Export Readable/Writable State classes 2012-12-13 17:00:30 -08:00
isaacs 5856823223 streams2: Fix duplex no-half-open logic 2012-12-13 17:00:29 -08:00
isaacs 286aa04910 streams2: Abstract out onread function 2012-12-13 17:00:29 -08:00
isaacs f624ccb475 streams2: Use StringDecoder.end 2012-12-13 17:00:29 -08:00
isaacs cf0b4ba410 streams2: flow() is not always bound to src 2012-12-13 17:00:28 -08:00
isaacs e82d06bef9 streams2: Fix regression from Duplex ctor assignment 2012-12-13 17:00:28 -08:00
isaacs 71e2b61388 streams2: Support write(chunk,[encoding],[callback]) 2012-12-13 17:00:27 -08:00
isaacs 0678480b57 streams2: Allow Writables to opt out of pre-buffer-izing 2012-12-13 17:00:27 -08:00
isaacs 545f512619 streams2: ctor guards on Stream classes 2012-12-13 17:00:26 -08:00
isaacs 8acb416ad0 streams2: Handle immediate synthetic transforms properly 2012-12-13 17:00:26 -08:00
isaacs 06e321d0f9 streams2: Correct drain/return logic
It was testing the length *before* adding the current chunk, which
is the opposite of correct.

Also, the return value was flipped.
2012-12-13 17:00:25 -08:00
isaacs 02f017d24f streams2: Allow 0 as a lowWaterMark value 2012-12-13 17:00:25 -08:00
isaacs caa853bb06 transform: Automatically read() on _write when read buffer is empty 2012-12-13 17:00:25 -08:00
isaacs 3b59fd70f4 streams2: Make Transform streams pull-style
That is, the transform is triggered by a _read, not by a _write.

This way, backpressure works properly.
2012-12-13 17:00:24 -08:00
isaacs 9b5abe5bfe streams2: setEncoding and abstract out endReadable 2012-12-13 17:00:24 -08:00
isaacs 51a52c43a2 streams2: Set flowing=true when flowing 2012-12-13 17:00:24 -08:00
isaacs 639fbe28d1 streams2: Convert strings to buffers before passing to _write() 2012-12-13 17:00:23 -08:00
isaacs 420e07c577 streams2: The new stream base classes 2012-12-13 17:00:23 -08:00
isaacs 17834ed28c Add 'stream' as a native module in repl 2012-12-13 17:00:23 -08:00
isaacs 314c6b3060 Don't allow invalid encodings in StringDecoder class 2012-12-13 17:00:22 -08:00
isaacs 77ed12fe7a Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/test/test-spawn.c
	deps/uv/uv.gyp
	src/cares_wrap.cc
	src/node.cc
	src/node_version.h
	test/simple/test-buffer.js
	tools/gyp/pylib/gyp/common.py
	tools/install.py
2012-12-13 16:57:58 -08:00
Ben Noordhuis d65832ccd0 fs: fix WriteStream fd leak
Close the file descriptor when a write operation fails.

Fixes #4387.
2012-12-12 09:46:22 +01:00
Ben Noordhuis 6e97b2cc17 fs: fix ReadStream fd leak
Close the file descriptor when a read operation fails.

Fixes #4387.
2012-12-12 09:46:22 +01:00