- Version: master
- Platform: all
- Subsystem: streams
|
// if it's past the high water mark, we can push in some more. |
|
// Also, if we have no data yet, we can stand some |
|
// more bytes. This is to work around cases where hwm=0, |
|
// such as the repl. Also, if the push() triggered a |
|
// readable event, and the user called read(largeNumber) such that |
|
// needReadable was set, then we ought to push more, so that another |
|
// 'readable' event will be triggered. |
|
function needMoreData(state) { |
|
return !state.ended && |
|
(state.length < state.highWaterMark || |
|
state.length === 0); |
|
} |
comment is out of date (ref.
#19613 (comment)).
Specifically it states:
I think that comment is actually wrong. It says
if it's past the high water mark, we can push in some more.
However it has a check (simplified) as:
return state.length < state.highWaterMark
Which will return true if we are below the watermark.
This would be a good issue for someone willing to learn more about streams.
node/lib/_stream_readable.js
Lines 304 to 315 in d37e59f
Specifically it states:
I think that comment is actually wrong. It says
However it has a check (simplified) as:
Which will return
trueif we are below the watermark.This would be a good issue for someone willing to learn more about streams.