diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-10-07 13:58:49 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-10-07 13:58:55 -0700 |
commit | 26c08a3f35f251c86a881aa70a8e709216feb03d (patch) | |
tree | f357e3d0ff23b280c85824643cea86dc0769cc06 /test/fixtures | |
parent | 153629c99a8f26efccfc9b75dd1e86741c968f17 (diff) | |
download | nodejs-26c08a3f35f251c86a881aa70a8e709216feb03d.tar.gz nodejs-26c08a3f35f251c86a881aa70a8e709216feb03d.tar.bz2 nodejs-26c08a3f35f251c86a881aa70a8e709216feb03d.zip |
Do load balancing test in test-child-process-fork2.
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/fork2.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/fixtures/fork2.js b/test/fixtures/fork2.js index 8958a7915..8aa579c31 100644 --- a/test/fixtures/fork2.js +++ b/test/fixtures/fork2.js @@ -1,9 +1,27 @@ var assert = require('assert'); +var net = require('net'); + +var connections = 0; process.on('message', function(m, server) { console.log('CHILD got message:', m); assert.ok(m.hello); + assert.ok(server); - process.send({ gotHandle: true }); + assert.ok(server instanceof net.Server); + + // TODO need better API for this. + server._backlog = 9; + + server.listen(function() { + process.send({ gotHandle: true }); + }); + + server.on('connection', function(c) { + connections++; + console.log('CHILD got connection'); + c.destroy(); + process.send({ childConnections: connections }); + }); }); |