mirror of https://github.com/nodejs/node.git
stream: Pipe data in chunks matching read data
This creates better flow for large values of lowWaterMark.pull/24504/head
parent
8476aefc8e
commit
0a9930a230
|
@ -137,8 +137,13 @@ function howMuchToRead(n, state) {
|
|||
if (state.objectMode)
|
||||
return n === 0 ? 0 : 1;
|
||||
|
||||
if (isNaN(n) || n === null)
|
||||
return state.length;
|
||||
if (isNaN(n) || n === null) {
|
||||
// only flow one buffer at a time
|
||||
if (state.flowing && state.buffer.length)
|
||||
return state.buffer[0].length;
|
||||
else
|
||||
return state.length;
|
||||
}
|
||||
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue