Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Update benchmark script to new API
  • Loading branch information
ry committed Feb 17, 2010
1 parent 916d592 commit 7c1c89f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions benchmark/http_simple.js
Expand Up @@ -53,6 +53,5 @@ http.createServer(function (req, res) {
}
);
res.write(body);

res.finish();
res.close();
}).listen(8000);
10 changes: 7 additions & 3 deletions benchmark/static_http_server.js
Expand Up @@ -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++;
}

Expand All @@ -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++;
}

0 comments on commit 7c1c89f

Please sign in to comment.