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 761af37

Browse filesBrowse files
Devin NakamuraMyles Borins
authored andcommitted
test: fix race condition in test-http-client-onerror
Occasionally test-http-client-onerror will fail with a refused connection. This patch fixes the possibility that connections will be attempted before server is listening. PR-URL: #4346 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9808521 commit 761af37
Copy full SHA for 761af37

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/gc/test-http-client-onerror.js‎

Copy file name to clipboardExpand all lines: test/gc/test-http-client-onerror.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ console.log('We should do ' + todo + ' requests');
2222

2323
var http = require('http');
2424
var server = http.createServer(serverHandler);
25-
server.listen(PORT, getall);
25+
server.listen(PORT, runTest);
2626

2727
function getall() {
2828
if (count >= todo)
@@ -51,8 +51,10 @@ function getall() {
5151
setImmediate(getall);
5252
}
5353

54-
for (var i = 0; i < 10; i++)
55-
getall();
54+
function runTest() {
55+
for (var i = 0; i < 10; i++)
56+
getall();
57+
}
5658

5759
function afterGC() {
5860
countGC ++;

0 commit comments

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