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 ce060b7

Browse filesBrowse files
idandagan1gibfahn
authored andcommitted
test: use Countdown in http test
PR-URL: #17506 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent fdb216a commit ce060b7
Copy full SHA for ce060b7

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/parallel/test-http-incoming-pipelined-socket-destroy.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-incoming-pipelined-socket-destroy.js
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const Countdown = require('../common/countdown');
2425

2526
const http = require('http');
2627
const net = require('net');
2728

2829
const seeds = [ 3, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 ];
30+
const countdown = new Countdown(seeds.length, () => server.close());
2931

3032
// Set up some timing issues where sockets can be destroyed
3133
// via either the req or res.
@@ -72,11 +74,8 @@ function generator(seeds) {
7274

7375
server.listen(0, common.mustCall(function() {
7476
const client = net.connect({ port: this.address().port });
75-
let done = 0;
7677
server.on('requestDone', function() {
77-
if (++done === seeds.length) {
78-
server.close();
79-
}
78+
countdown.dec();
8079
});
8180

8281
// immediately write the pipelined requests.

0 commit comments

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