-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: fix readable state
awaitDrain
increase in recursion
PR-URL: #27572 Reviewed-By: Anna Henningsen <[email protected]>
- Loading branch information
Showing
6 changed files
with
101 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
test/parallel/test-stream-await-drain-writers-in-synchronously-recursion-write.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { PassThrough } = require('stream'); | ||
|
||
const encode = new PassThrough({ | ||
highWaterMark: 1 | ||
}); | ||
|
||
const decode = new PassThrough({ | ||
highWaterMark: 1 | ||
}); | ||
|
||
const send = common.mustCall((buf) => { | ||
encode.write(buf); | ||
}, 4); | ||
|
||
let i = 0; | ||
const onData = common.mustCall(() => { | ||
if (++i === 2) { | ||
send(Buffer.from([0x3])); | ||
send(Buffer.from([0x4])); | ||
} | ||
}, 4); | ||
|
||
encode.pipe(decode).on('data', onData); | ||
|
||
send(Buffer.from([0x1])); | ||
send(Buffer.from([0x2])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters