src: move debug agent from deps/ to src/
[platform/upstream/nodejs.git] / benchmark / idle_server.js
1 net = require('net');
2 connections = 0;
3
4 var errors = 0;
5
6 server = net.Server(function (socket) {
7
8   socket.on('error', function () {
9     errors++; 
10   });
11
12 });
13
14 //server.maxConnections = 128;
15
16 server.listen(9000);
17
18 var oldConnections, oldErrors;
19
20 setInterval(function () {
21   if (oldConnections != server.connections) {
22     oldConnections = server.connections;
23     console.log("SERVER %d connections: %d", process.pid, server.connections);
24   }
25
26   if (oldErrors != errors) {
27     oldErrors = errors;
28     console.log("SERVER %d errors: %d", process.pid, errors);
29   }
30 }, 1000);
31