mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
stream: drain Transform with 0 highWaterMark
Fixes: https://github.com/nodejs/node/issues/40935 PR-URL: https://github.com/nodejs/node/pull/40947 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
90faf55510
commit
37f1dd9ccd
@ -196,6 +196,7 @@ Transform.prototype._write = function(chunk, encoding, callback) {
|
||||
wState.ended || // Backwards compat.
|
||||
length === rState.length || // Backwards compat.
|
||||
rState.length < rState.highWaterMark ||
|
||||
rState.highWaterMark === 0 ||
|
||||
rState.length === 0
|
||||
) {
|
||||
callback();
|
||||
|
8
test/parallel/test-stream-passthrough-drain.js
Normal file
8
test/parallel/test-stream-passthrough-drain.js
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const { PassThrough } = require('stream');
|
||||
|
||||
const pt = new PassThrough({ highWaterMark: 0 });
|
||||
pt.on('drain', common.mustCall());
|
||||
pt.write('hello');
|
||||
pt.read();
|
Loading…
Reference in New Issue
Block a user