summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexis Campailla <alexis@janeasystems.com>2014-01-23 07:10:24 -0800
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-01-23 12:42:36 -0800
commit5d4f4ee310eab1f82d99caefee4c4c60a48620ff (patch)
treeeefb899a0635a0ba395a35e5729ce017e9fbf9db /test
parent5aebc7352589222b2bfe9aecddbe6ff35572613e (diff)
downloadnode-new-5d4f4ee310eab1f82d99caefee4c4c60a48620ff.tar.gz
test: fix http-many-ended-pipelines server close
The test was calling server.close() without waiting for the server to have received all the requests. This would cause an ECONNRESET.
Diffstat (limited to 'test')
-rw-r--r--test/simple/test-http-many-ended-pipelines.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/simple/test-http-many-ended-pipelines.js b/test/simple/test-http-many-ended-pipelines.js
index 0d625be12e..dffde722f2 100644
--- a/test/simple/test-http-many-ended-pipelines.js
+++ b/test/simple/test-http-many-ended-pipelines.js
@@ -32,23 +32,25 @@ console.trace = function() {
var http = require('http');
var net = require('net');
+var numRequests = 20;
+var done = 0;
+
var server = http.createServer(function(req, res) {
res.end('ok');
// Oh no! The connection died!
req.socket.destroy();
+ if (++done == numRequests)
+ server.close();
});
server.listen(common.PORT);
var client = net.connect({ port: common.PORT, allowHalfOpen: true });
-for (var i = 0; i < 20; i++) {
+for (var i = 0; i < numRequests; i++) {
client.write('GET / HTTP/1.1\r\n' +
'Host: some.host.name\r\n'+
'\r\n\r\n');
}
client.end();
-client.on('connect', function() {
- server.close();
-});
client.pipe(process.stdout);