diff --git a/lib/net.js b/lib/net.js index 7c61bfcb47d235..5b1958098bcbbf 100644 --- a/lib/net.js +++ b/lib/net.js @@ -552,7 +552,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', { ObjectDefineProperty(Socket.prototype, 'bufferSize', { get: function() { if (this._handle) { - return this[kLastWriteQueueSize] + this.writableLength; + return this.writableLength; } } }); diff --git a/test/parallel/test-tls-buffersize.js b/test/parallel/test-tls-buffersize.js index c94b95d7b32d31..eadd4cb1e40c9e 100644 --- a/test/parallel/test-tls-buffersize.js +++ b/test/parallel/test-tls-buffersize.js @@ -31,7 +31,7 @@ server.listen(0, common.mustCall(() => { for (let i = 1; i < iter; i++) { client.write('a'); - assert.strictEqual(client.bufferSize, i + 1); + assert.strictEqual(client.bufferSize, i); } client.on('finish', common.mustCall(() => { diff --git a/test/parallel/test-tls-streamwrap-buffersize.js b/test/parallel/test-tls-streamwrap-buffersize.js index f65a3d6e76b9d8..13eb1ce1d85da8 100644 --- a/test/parallel/test-tls-streamwrap-buffersize.js +++ b/test/parallel/test-tls-streamwrap-buffersize.js @@ -56,7 +56,7 @@ const net = require('net'); for (let i = 1; i < iter; i++) { client.write('a'); - assert.strictEqual(client.bufferSize, i + 1); + assert.strictEqual(client.bufferSize, i); } // It seems that tlsSockets created from sockets of `Duplex` emit no