Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce5d0db

Browse filesBrowse files
ronagaddaleax
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 <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 09a1289 commit ce5d0db
Copy full SHA for ce5d0db

File tree

Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed
Open diff view settings
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
552552
ObjectDefineProperty(Socket.prototype, 'bufferSize', {
553553
get: function() {
554554
if (this._handle) {
555-
return this[kLastWriteQueueSize] + this.writableLength;
555+
return this.writableLength;
556556
}
557557
}
558558
});
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-tls-buffersize.js
+1-1Lines changed: 1 addition & 1 deletion
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(() => {
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-tls-streamwrap-buffersize.js
+1-1Lines changed: 1 addition & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.