Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Devin Nakamura committed Dec 18, 2015
commit 95aa340ece1df079cf0bcf34bd8b5b93cffc2019
8 changes: 5 additions & 3 deletions test/gc/test-http-client-onerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ console.log('We should do ' + todo + ' requests');

var http = require('http');
var server = http.createServer(serverHandler);
server.listen(PORT, getall);
server.listen(PORT, runTest);

function getall() {
if (count >= todo)
Expand Down Expand Up @@ -51,8 +51,10 @@ function getall() {
setImmediate(getall);
}

for (var i = 0; i < 10; i++)
getall();
function runTest() {
for (var i = 0; i < 10; i++)
getall();
}

function afterGC() {
countGC ++;
Expand Down