Skip to content

Commit ce30b27

Browse files
author
Vishal Bisht
committed
stream: highWaterMark checks fix
1 parent 3650972 commit ce30b27

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/_stream_readable.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,7 @@ function chunkInvalid(state, chunk) {
311311
// 'readable' event will be triggered.
312312
function needMoreData(state) {
313313
return !state.ended &&
314-
(state.length < state.highWaterMark ||
315-
state.length === 0);
314+
(state.length < state.highWaterMark);
316315
}
317316

318317
Readable.prototype.isPaused = function() {
@@ -434,7 +433,7 @@ Readable.prototype.read = function(n) {
434433
debug('need readable', doRead);
435434

436435
// if we currently have less than the highWaterMark, then also read some
437-
if (state.length === 0 || state.length - n < state.highWaterMark) {
436+
if (state.length - n < state.highWaterMark) {
438437
doRead = true;
439438
debug('length less than watermark', doRead);
440439
}

0 commit comments

Comments
 (0)