Skip to content

Commit b7e9b43

Browse files
ronagMylesBorins
authored andcommitted
net: fix bufferSize
bufferSize should only look at writableLength otherwise it will always show more than what is actually pending. PR-URL: #34088 Refs: #34078 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 41c80f6 commit b7e9b43

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/net.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
553553
ObjectDefineProperty(Socket.prototype, 'bufferSize', {
554554
get: function() {
555555
if (this._handle) {
556-
return this[kLastWriteQueueSize] + this.writableLength;
556+
return this.writableLength;
557557
}
558558
}
559559
});

test/parallel/test-tls-buffersize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ server.listen(0, common.mustCall(() => {
3131

3232
for (let i = 1; i < iter; i++) {
3333
client.write('a');
34-
assert.strictEqual(client.bufferSize, i + 1);
34+
assert.strictEqual(client.bufferSize, i);
3535
}
3636

3737
client.on('finish', common.mustCall(() => {

test/parallel/test-tls-streamwrap-buffersize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const net = require('net');
5656

5757
for (let i = 1; i < iter; i++) {
5858
client.write('a');
59-
assert.strictEqual(client.bufferSize, i + 1);
59+
assert.strictEqual(client.bufferSize, i);
6060
}
6161

6262
// It seems that tlsSockets created from sockets of `Duplex` emit no

0 commit comments

Comments
 (0)