mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 13:05:07 +00:00
Update benchmark script to new API
This commit is contained in:
parent
916d592be1
commit
7c1c89fc29
@ -53,6 +53,5 @@ http.createServer(function (req, res) {
|
||||
}
|
||||
);
|
||||
res.write(body);
|
||||
|
||||
res.finish();
|
||||
res.close();
|
||||
}).listen(8000);
|
||||
|
@ -21,14 +21,16 @@ var server = http.createServer(function (req, res) {
|
||||
"Content-Length": body.length
|
||||
});
|
||||
res.write(body);
|
||||
res.finish();
|
||||
res.close();
|
||||
})
|
||||
server.listen(port);
|
||||
|
||||
function responseListener (res) {
|
||||
res.addListener("end", function () {
|
||||
if (requests < n) {
|
||||
res.client.request("/").finish(responseListener);
|
||||
var req = res.client.request("/");
|
||||
req.addListener('response', responseListener);
|
||||
req.close();
|
||||
requests++;
|
||||
}
|
||||
|
||||
@ -41,6 +43,8 @@ function responseListener (res) {
|
||||
for (var i = 0; i < concurrency; i++) {
|
||||
var client = http.createClient(port);
|
||||
client.id = i;
|
||||
client.request("/").finish(responseListener);
|
||||
var req = client.request("/");
|
||||
req.addListener('response', responseListener);
|
||||
req.close();
|
||||
requests++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user