Permalink
Browse files

test: Fix premature close in test-http-client-timeout-agent

  • Loading branch information...
1 parent 411d460 commit ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a @isaacs isaacs committed Sep 25, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 test/simple/test-http-client-timeout-agent.js
View
13 test/simple/test-http-client-timeout-agent.js
@@ -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() {

0 comments on commit ea2ceb7

Please sign in to comment.