summaryrefslogtreecommitdiff
path: root/test/pummel/test-net-many-clients.js
diff options
context:
space:
mode:
authorOleg Efimov <efimovov@gmail.com>2010-12-03 04:03:18 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-12-02 17:49:23 -0800
commitc0d69a488380fb3cfc1fb257972730ad5c570ef9 (patch)
tree55c008f6c6713ec30401ced1c49dc5bebe1d1b74 /test/pummel/test-net-many-clients.js
parentd3532a4bf294e9cbb7e6f6edec47477310dda14b (diff)
downloadandroid-node-v8-c0d69a488380fb3cfc1fb257972730ad5c570ef9.tar.gz
android-node-v8-c0d69a488380fb3cfc1fb257972730ad5c570ef9.tar.bz2
android-node-v8-c0d69a488380fb3cfc1fb257972730ad5c570ef9.zip
GJSLint part of tests
Diffstat (limited to 'test/pummel/test-net-many-clients.js')
-rw-r--r--test/pummel/test-net-many-clients.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/pummel/test-net-many-clients.js b/test/pummel/test-net-many-clients.js
index f6e3619d39..e389099829 100644
--- a/test/pummel/test-net-many-clients.js
+++ b/test/pummel/test-net-many-clients.js
@@ -1,56 +1,56 @@
-common = require("../common");
-assert = common.assert
-net = require("net");
+common = require('../common');
+assert = common.assert;
+net = require('net');
// settings
-var bytes = 1024*40;
+var bytes = 1024 * 40;
var concurrency = 100;
var connections_per_client = 5;
// measured
var total_connections = 0;
-var body = "";
+var body = '';
for (var i = 0; i < bytes; i++) {
- body += "C";
+ body += 'C';
}
-var server = net.createServer(function (c) {
- c.addListener("connect", function () {
+var server = net.createServer(function(c) {
+ c.addListener('connect', function() {
total_connections++;
- common.print("#");
+ common.print('#');
c.write(body);
c.end();
});
});
-function runClient (callback) {
+function runClient(callback) {
var client = net.createConnection(common.PORT);
client.connections = 0;
- client.setEncoding("utf8");
+ client.setEncoding('utf8');
- client.addListener("connect", function () {
- common.print("c");
- client.recved = "";
+ client.addListener('connect', function() {
+ common.print('c');
+ client.recved = '';
client.connections += 1;
});
- client.addListener("data", function (chunk) {
+ client.addListener('data', function(chunk) {
this.recved += chunk;
});
- client.addListener("end", function () {
+ client.addListener('end', function() {
client.end();
});
- client.addListener("error", function (e) {
- console.log("\n\nERROOOOOr");
+ client.addListener('error', function(e) {
+ console.log('\n\nERROOOOOr');
throw e;
});
- client.addListener("close", function (had_error) {
- common.print(".");
+ client.addListener('close', function(had_error) {
+ common.print('.');
assert.equal(false, had_error);
assert.equal(bytes, client.recved.length);
@@ -67,16 +67,16 @@ function runClient (callback) {
});
}
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
var finished_clients = 0;
for (var i = 0; i < concurrency; i++) {
- runClient(function () {
+ runClient(function() {
if (++finished_clients == concurrency) server.close();
});
}
});
-process.addListener("exit", function () {
+process.addListener('exit', function() {
assert.equal(connections_per_client * concurrency, total_connections);
- console.log("\nokay!");
+ console.log('\nokay!');
});