File tree 3 files changed +15
-5
lines changed 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
2059
2059
additional data onto the queue.
2060
2060
2061
2061
Once 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.
2063
2065
2064
2066
The ` size ` argument is advisory. For implementations where a "read" is a
2065
2067
single 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 {
20
20
}
21
21
22
22
_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
+ }
25
29
}
26
30
27
31
_final ( callback ) {
Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ class DuplexSocket extends Duplex {
24
24
_write ( chunk , encoding , callback ) {
25
25
assert . notStrictEqual ( this [ kOtherSide ] , null ) ;
26
26
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
+ }
29
33
}
30
34
31
35
_final ( callback ) {
You can’t perform that action at this time.
0 commit comments