Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
stream: don't read when paused
Readable should not read when paused. Noticed while working
on further streamifying net with _construct.
  • Loading branch information
ronag committed Jun 28, 2020
commit db6a98ea911064385ea4e0392322b818050d0f2f
2 changes: 1 addition & 1 deletion lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ function maybeReadMore_(stream, state) {
// called push() with new data. In this case we skip performing more
// read()s. The execution ends in this method again after the _read() ends
// up calling push() with more data.
while (!state.reading && !state.ended &&
while (!state.reading && !state.ended && state[kPaused] !== true &&
(state.length < state.highWaterMark ||
(state.flowing && state.length === 0))) {
const len = state.length;
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-stream-construct.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,14 @@ testDestroy((opts) => new Writable({
construct: common.mustCall()
});
}

{
// Readable paused
const readable = new Readable({
construct: common.mustCall((callback) => {
readable.pause();
callback();
}),
read: common.mustNotCall()
});
}