2011-10-07 11:43:44 +02:00
|
|
|
var assert = require('assert');
|
2011-10-07 22:58:49 +02:00
|
|
|
var net = require('net');
|
|
|
|
|
|
|
|
var connections = 0;
|
2011-10-07 11:43:44 +02:00
|
|
|
|
|
|
|
process.on('message', function(m, server) {
|
|
|
|
console.log('CHILD got message:', m);
|
|
|
|
assert.ok(m.hello);
|
2011-10-07 22:58:49 +02:00
|
|
|
|
2011-10-07 11:43:44 +02:00
|
|
|
assert.ok(server);
|
2011-10-07 22:58:49 +02:00
|
|
|
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 });
|
|
|
|
});
|
2011-10-07 11:43:44 +02:00
|
|
|
});
|
|
|
|
|