Skip to content

Commit

Permalink
Don't disturb on resume()
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Dec 12, 2024
1 parent deae3fe commit b2b13a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@ class Readable extends Stream {

resume () {
this._duplexState |= READ_RESUMED_READ_AHEAD
this._readableState.flowed = true
this._readableState.updateNextTick()
return this
}
Expand Down
14 changes: 12 additions & 2 deletions test/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,26 @@ test('setEncoding empty string', async function (t) {
})

test('is disturbed', function (t) {
const r = new Readable()
let r = new Readable()
t.is(Readable.isDisturbed(r), false)

r.push('hello')
t.is(Readable.isDisturbed(r), false)

r.resume()
t.is(Readable.isDisturbed(r), true)
t.is(Readable.isDisturbed(r), false)

r.pause()
t.is(Readable.isDisturbed(r), false)

r.read()
t.is(Readable.isDisturbed(r), true)

r = new Readable()
r.push('hello')
t.is(Readable.isDisturbed(r), false)

r.on('data', () => {})
t.is(Readable.isDisturbed(r), true)
})

Expand Down

0 comments on commit b2b13a4

Please sign in to comment.