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 b6d33f6

Browse filesBrowse files
rustyconovercodebytere
authored andcommitted
test: change test to not be sensitive to buffer send size
Change the test to not be sensitive to the buffer size causing TCP resets to be received by the client causing the test to fail. The test now reads the entire expected buffer and then checks for the expected event to fire. PR-URL: #31499 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent cef5502 commit b6d33f6
Copy full SHA for b6d33f6

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+11
-6
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-tls-close-event-after-write.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-close-event-after-write.js
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,35 @@ const tls = require('tls');
1212
const fixtures = require('../common/fixtures');
1313
let cconn = null;
1414
let sconn = null;
15+
let read_len = 0;
16+
const buffer_size = 1024 * 1024;
1517

1618
function test() {
1719
if (cconn && sconn) {
1820
cconn.resume();
1921
sconn.resume();
20-
sconn.end(Buffer.alloc(1024 * 1024));
21-
cconn.end();
22+
sconn.end(Buffer.alloc(buffer_size));
2223
}
2324
}
2425

2526
const server = tls.createServer({
2627
key: fixtures.readKey('agent1-key.pem'),
2728
cert: fixtures.readKey('agent1-cert.pem')
28-
}, function(c) {
29-
c.on('close', function() {
30-
server.close();
31-
});
29+
}, (c) => {
30+
c.on('close', common.mustCall(() => server.close()));
3231
sconn = c;
3332
test();
3433
}).listen(0, common.mustCall(function() {
3534
tls.connect(this.address().port, {
3635
rejectUnauthorized: false
3736
}, common.mustCall(function() {
3837
cconn = this;
38+
cconn.on('data', (d) => {
39+
read_len += d.length;
40+
if (read_len === buffer_size) {
41+
cconn.end();
42+
}
43+
});
3944
test();
4045
}));
4146
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.