diff options
author | isaacs <i@izs.me> | 2012-09-25 11:15:44 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-09-25 11:15:52 -0700 |
commit | ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a (patch) | |
tree | a8805b7c61ada543b9f8c9530484385f16559361 | |
parent | 411d46087f4027db69a5906985109a2b16f9ff52 (diff) | |
download | android-node-v8-ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a.tar.gz android-node-v8-ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a.tar.bz2 android-node-v8-ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a.zip |
test: Fix premature close in test-http-client-timeout-agent
-rw-r--r-- | test/simple/test-http-client-timeout-agent.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/simple/test-http-client-timeout-agent.js b/test/simple/test-http-client-timeout-agent.js index d3b30ea8e0..79d0a24242 100644 --- a/test/simple/test-http-client-timeout-agent.js +++ b/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() { |