mirror of https://github.com/lukechilds/node.git
Ryan Dahl
13 years ago
4 changed files with 106 additions and 47 deletions
@ -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 }); |
|||
}); |
|||
}); |
|||
|
|||
|
Loading…
Reference in new issue