diff options
Diffstat (limited to 'lib/_stream_writable.js')
-rw-r--r-- | lib/_stream_writable.js | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index d6c84d9494..9fe4c85bd3 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -41,21 +41,13 @@ function WritableState(options, stream) { var hwm = options.highWaterMark; this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - // the point that it has to get to before we call _write(chunk,cb) - // default to pushing everything out as fast as possible. - this.lowWaterMark = options.lowWaterMark || 0; - // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; // cast to ints. - this.lowWaterMark = ~~this.lowWaterMark; this.highWaterMark = ~~this.highWaterMark; - if (this.lowWaterMark > this.highWaterMark) - throw new Error('lowWaterMark cannot be higher than highWaterMark'); - this.needDrain = false; // at the start of calling end() this.ending = false; @@ -225,7 +217,7 @@ function onwrite(stream, er) { return; } - if (state.length <= state.lowWaterMark && state.needDrain) { + if (state.length === 0 && state.needDrain) { // Must force callback to be called on nextTick, so that we don't // emit 'drain' before the write() consumer gets the 'false' return // value, and has a chance to attach a 'drain' listener. |