Skip to content

Commit

Permalink
test: Fix premature close in test-http-client-timeout-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 25, 2012
1 parent 411d460 commit ea2ceb7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/simple/test-http-client-timeout-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,16 @@ server.listen(options.port, options.host, function() {
});
req.end();
}
setTimeout(function() {
server.close();
}, 150);

setTimeout(function maybeDone() {
if (requests_done >= requests_sent) {
setTimeout(function() {
server.close();
}, 100);
} else {
setTimeout(maybeDone, 100);
}
}, 100);
});

process.on('exit', function() {
Expand Down

0 comments on commit ea2ceb7

Please sign in to comment.