summaryrefslogtreecommitdiff
path: root/test/gc
diff options
context:
space:
mode:
authorDevin Nakamura <devinn@ca.ibm.com>2015-12-18 10:50:11 -0500
committerJames M Snell <jasnell@gmail.com>2015-12-30 11:47:51 -0800
commit2413a4e99d548ac67c549fb699c6c2d209544e3a (patch)
treee1d64257bc3142a23c5260b66147518acc6184d0 /test/gc
parenta030c5cf49c143545258b9f2d67e566cb2bfcdfd (diff)
downloadandroid-node-v8-2413a4e99d548ac67c549fb699c6c2d209544e3a.tar.gz
android-node-v8-2413a4e99d548ac67c549fb699c6c2d209544e3a.tar.bz2
android-node-v8-2413a4e99d548ac67c549fb699c6c2d209544e3a.zip
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test/gc')
-rw-r--r--test/gc/test-http-client-onerror.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js
index 98d046e180..7e50683c66 100644
--- a/test/gc/test-http-client-onerror.js
+++ b/test/gc/test-http-client-onerror.js
@@ -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)
@@ -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 ++;