3 var errors = 0, connections = 0;
8 process.nextTick(function () {
10 var gotConnected = false;
13 s.on('connect', function () {
19 s.on('close', function () {
20 if (gotConnected) connections--;
21 lastClose = new Date();
24 s.on('error', function () {
33 var oldConnections, oldErrors;
35 // Try to start new connections every so often
36 setInterval(connect, 5000);
38 setInterval(function () {
39 if (oldConnections != connections) {
40 oldConnections = connections;
41 console.log("CLIENT %d connections: %d", process.pid, connections);
44 if (oldErrors != errors) {
46 console.log("CLIENT %d errors: %d", process.pid, errors);