Skip to content

Commit

Permalink
fixup: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Oct 3, 2019
1 parent 0faf029 commit b2600ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/internal/streams/duplexpair.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class DuplexSocket extends Duplex {
}

_write(chunk, encoding, callback) {
this[kOtherSide].push(chunk);
if (!this[kOtherSide].readableLength) {
if (chunk.length === 0) {
process.nextTick(callback);
} else {
this[kOtherSide].push(chunk);
this[kOtherSide][kCallback] = callback;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/common/duplexpair.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class DuplexSocket extends Duplex {
_write(chunk, encoding, callback) {
assert.notStrictEqual(this[kOtherSide], null);
assert.strictEqual(this[kOtherSide][kCallback], null);
this[kOtherSide].push(chunk);
if (!this[kOtherSide].readableLength) {
if (chunk.length === 0) {
process.nextTick(callback);
} else {
this[kOtherSide].push(chunk);
this[kOtherSide][kCallback] = callback;
}
}
Expand Down

0 comments on commit b2600ca

Please sign in to comment.