mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
net: fix bufferSize
bufferSize should only look at writableLength otherwise it will always show more than what is actually pending. PR-URL: https://github.com/nodejs/node/pull/34088 Refs: https://github.com/nodejs/node/issues/34078 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
41c80f6abe
commit
b7e9b43b2f
3 files changed
+3
-3
No files matched your search
+1
-1
@@ -553,7 +553,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
|
||||
ObjectDefineProperty(Socket.prototype, 'bufferSize', {
|
||||
get: function() {
|
||||
if (this._handle) {
|
||||
return this[kLastWriteQueueSize] + this.writableLength;
|
||||
return this.writableLength;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user