Skip to content

Commit b2600ca

Browse files
committed
fixup: simplify
1 parent 0faf029 commit b2600ca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/streams/duplexpair.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class DuplexSocket extends Duplex {
2020
}
2121

2222
_write(chunk, encoding, callback) {
23-
this[kOtherSide].push(chunk);
24-
if (!this[kOtherSide].readableLength) {
23+
if (chunk.length === 0) {
2524
process.nextTick(callback);
2625
} else {
26+
this[kOtherSide].push(chunk);
2727
this[kOtherSide][kCallback] = callback;
2828
}
2929
}

test/common/duplexpair.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ 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].push(chunk);
28-
if (!this[kOtherSide].readableLength) {
27+
if (chunk.length === 0) {
2928
process.nextTick(callback);
3029
} else {
30+
this[kOtherSide].push(chunk);
3131
this[kOtherSide][kCallback] = callback;
3232
}
3333
}

0 commit comments

Comments
 (0)