File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -2059,7 +2059,9 @@ when `_read()` is called again after it has stopped should it resume pushing
20592059additional data onto the queue.
20602060
20612061Once the ` readable._read() ` method has been called, it will not be called again
2062- until the [ ` readable.push() ` ] [ stream-push ] method is called.
2062+ until more data is pushed through the [ ` readable.push() ` ] [ stream-push ] method.
2063+ Empty data such as empty buffers and strings will not cause ` readable._read() `
2064+ to be called.
20632065
20642066The ` size ` argument is advisory. For implementations where a "read" is a
20652067single operation that returns data can use the ` size ` argument to determine how
Original file line number Diff line number Diff line change @@ -20,8 +20,12 @@ class DuplexSocket extends Duplex {
2020 }
2121
2222 _write ( chunk , encoding , callback ) {
23- this [ kOtherSide ] [ kCallback ] = callback ;
24- this [ kOtherSide ] . push ( chunk ) ;
23+ if ( chunk . length === 0 ) {
24+ process . nextTick ( callback ) ;
25+ } else {
26+ this [ kOtherSide ] . push ( chunk ) ;
27+ this [ kOtherSide ] [ kCallback ] = callback ;
28+ }
2529 }
2630
2731 _final ( callback ) {
Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ class DuplexSocket extends Duplex {
2424 _write ( chunk , encoding , callback ) {
2525 assert . notStrictEqual ( this [ kOtherSide ] , null ) ;
2626 assert . strictEqual ( this [ kOtherSide ] [ kCallback ] , null ) ;
27- this [ kOtherSide ] [ kCallback ] = callback ;
28- this [ kOtherSide ] . push ( chunk ) ;
27+ if ( chunk . length === 0 ) {
28+ process . nextTick ( callback ) ;
29+ } else {
30+ this [ kOtherSide ] . push ( chunk ) ;
31+ this [ kOtherSide ] [ kCallback ] = callback ;
32+ }
2933 }
3034
3135 _final ( callback ) {
You can’t perform that action at this time.
0 commit comments