2012-06-14 15:12:54 +02:00
|
|
|
/**
|
|
|
|
* Notification server. Launch with:
|
|
|
|
*
|
|
|
|
* sudo node aphlict_server.js --user=aphlict
|
|
|
|
*
|
2012-12-20 00:19:23 +01:00
|
|
|
* You can also specify `port`, `admin`, `host` and `log`.
|
2012-06-14 15:12:54 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
var config = parse_command_line_arguments(process.argv);
|
|
|
|
|
|
|
|
function parse_command_line_arguments(argv) {
|
|
|
|
var config = {
|
|
|
|
port : 22280,
|
|
|
|
admin : 22281,
|
2012-12-20 00:19:23 +01:00
|
|
|
host : '127.0.0.1',
|
2012-06-14 15:12:54 +02:00
|
|
|
user : null,
|
|
|
|
log: '/var/log/aphlict.log'
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var ii = 2; ii < argv.length; ii++) {
|
|
|
|
var arg = argv[ii];
|
|
|
|
var matches = arg.match(/^--([^=]+)=(.*)$/);
|
|
|
|
if (!matches) {
|
|
|
|
throw new Error("Unknown argument '"+arg+"'!");
|
|
|
|
}
|
|
|
|
if (!(matches[1] in config)) {
|
|
|
|
throw new Error("Unknown argument '"+matches[1]+"'!");
|
|
|
|
}
|
|
|
|
config[matches[1]] = matches[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
config.port = parseInt(config.port, 10);
|
|
|
|
config.admin = parseInt(config.admin, 10);
|
|
|
|
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2013-05-19 02:04:22 +02:00
|
|
|
if (process.getuid() !== 0) {
|
2012-06-14 15:12:54 +02:00
|
|
|
console.log(
|
|
|
|
"ERROR: "+
|
|
|
|
"This server must be run as root because it needs to bind to privileged "+
|
|
|
|
"port 843 to start a Flash policy server. It will downgrade to run as a "+
|
|
|
|
"less-privileged user after binding if you pass a user in the command "+
|
|
|
|
"line arguments with '--user=alincoln'.");
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
var net = require('net');
|
2012-06-12 02:49:32 +02:00
|
|
|
var http = require('http');
|
|
|
|
var url = require('url');
|
|
|
|
var querystring = require('querystring');
|
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
// set up log file
|
2012-06-20 22:20:47 +02:00
|
|
|
var logfile = fs.createWriteStream(
|
|
|
|
config.log,
|
|
|
|
{
|
|
|
|
flags: 'a',
|
|
|
|
encoding: null,
|
|
|
|
mode: 0666
|
|
|
|
});
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
function log(str) {
|
2012-06-20 22:20:47 +02:00
|
|
|
console.log(str);
|
|
|
|
logfile.write(str + '\n');
|
2012-06-12 02:49:32 +02:00
|
|
|
}
|
|
|
|
|
2012-06-20 22:20:47 +02:00
|
|
|
process.on('uncaughtException', function (err) {
|
|
|
|
log("\n<<< UNCAUGHT EXCEPTION! >>>\n\n" + err);
|
|
|
|
process.exit(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
log('----- ' + (new Date()).toLocaleString() + ' -----\n');
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
|
|
|
|
function getFlashPolicy() {
|
|
|
|
return [
|
|
|
|
'<?xml version="1.0"?>',
|
|
|
|
'<!DOCTYPE cross-domain-policy SYSTEM ' +
|
|
|
|
'"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">',
|
|
|
|
'<cross-domain-policy>',
|
2012-06-14 15:12:54 +02:00
|
|
|
'<allow-access-from domain="*" to-ports="'+config.port+'"/>',
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
'</cross-domain-policy>'
|
2012-06-12 02:49:32 +02:00
|
|
|
].join('\n');
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
net.createServer(function(socket) {
|
2012-06-20 22:20:47 +02:00
|
|
|
socket.write(getFlashPolicy() + '\0');
|
|
|
|
socket.end();
|
|
|
|
|
|
|
|
log('[' + socket.remoteAddress + '] Sent Flash Policy');
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
socket.on('error', function (e) {
|
|
|
|
log('Error in policy server: ' + e);
|
|
|
|
});
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
}).listen(843);
|
|
|
|
|
|
|
|
|
2012-06-12 02:49:32 +02:00
|
|
|
function write_json(socket, data) {
|
|
|
|
var serial = JSON.stringify(data);
|
|
|
|
var length = Buffer.byteLength(serial, 'utf8');
|
|
|
|
length = length.toString();
|
|
|
|
while (length.length < 8) {
|
|
|
|
length = '0' + length;
|
|
|
|
}
|
|
|
|
socket.write(length + serial);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var clients = {};
|
|
|
|
var current_connections = 0;
|
|
|
|
// According to the internet up to 2^53 can
|
|
|
|
// be stored in javascript, this is less than that
|
|
|
|
var MAX_ID = 9007199254740991;//2^53 -1
|
|
|
|
|
|
|
|
// If we get one connections per millisecond this will
|
|
|
|
// be fine as long as someone doesn't maintain a
|
|
|
|
// connection for longer than 6854793 years. If
|
|
|
|
// you want to write something pretty be my guest
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
|
2012-06-12 02:49:32 +02:00
|
|
|
function generate_id() {
|
2013-05-19 02:04:22 +02:00
|
|
|
if (typeof generate_id.current_id == 'undefined' ||
|
|
|
|
generate_id.current_id > MAX_ID) {
|
2012-06-12 02:49:32 +02:00
|
|
|
generate_id.current_id = 0;
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
}
|
2012-06-12 02:49:32 +02:00
|
|
|
return generate_id.current_id++;
|
|
|
|
}
|
|
|
|
|
|
|
|
var send_server = net.createServer(function(socket) {
|
|
|
|
var client_id = generate_id();
|
2012-06-20 22:20:47 +02:00
|
|
|
var client_name = '[' + socket.remoteAddress + '] [#' + client_id + '] ';
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
|
2013-07-28 01:24:12 +02:00
|
|
|
clients[client_id] = socket;
|
|
|
|
current_connections++;
|
|
|
|
log(client_name + 'connected\t\t(' +
|
|
|
|
current_connections + ' current connections)');
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
socket.on('close', function() {
|
|
|
|
delete clients[client_id];
|
|
|
|
current_connections--;
|
2013-05-19 02:04:22 +02:00
|
|
|
log(client_name + 'closed\t\t(' +
|
|
|
|
current_connections + ' current connections)');
|
2012-06-12 02:49:32 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
socket.on('timeout', function() {
|
2012-06-20 22:20:47 +02:00
|
|
|
log(client_name + 'timed out!');
|
2012-06-12 02:49:32 +02:00
|
|
|
});
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
|
2012-06-12 02:49:32 +02:00
|
|
|
socket.on('end', function() {
|
2012-06-20 22:20:47 +02:00
|
|
|
log(client_name + 'ended the connection');
|
2012-06-12 02:49:32 +02:00
|
|
|
// node automatically closes half-open connections
|
|
|
|
});
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
|
2012-06-12 02:49:32 +02:00
|
|
|
socket.on('error', function (e) {
|
2013-06-28 23:42:40 +02:00
|
|
|
log(client_name + 'Uncaught error in send server: ' + e);
|
Aphlict, simple notification server
Summary:
This is purely a prototype at the moment, but the basic functionality sort of
works.
I'm not sure how far I want to go with this but I think we might be able to get
somewhere without it being gross.
The idea here is to build a notification server WITHOUT using Comet, since Comet
is extremely difficult and complicated.
Instead, I use Flash on the client. LocalConnection allows flash instances to
talk to each other and connect() can be used as a locking primitive. This allows
all the instances to elect a master instance in a race-safe way. The master is
responsible for opening a single connnection to the server.
On the server, I use Node.js since PHP is pretty unsuitable for this task.
See Github Issue #3: https://github.com/facebook/phabricator/issues/3
One thing I need to figure out next is if I can reasonably do SSL/TSL over Flash
(it looks like I can, in theory, with the as3crypto library) or if the server
needs to just send down version information and trigger a separate Ajax call on
the client.
Test Plan:
Created a client pool and connected it to the server, with election and failover
apparently working correctly.
Reviewed By: aran
Reviewers: Girish, aran, jungejason, tuomaspelkonen, davidrecordon
Commenters: Girish, davidrecordon
CC: aran, epriestley, Girish, davidrecordon
Differential Revision: 284
2011-05-15 23:05:02 +02:00
|
|
|
});
|
2012-06-14 15:12:54 +02:00
|
|
|
}).listen(config.port);
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
|
2012-06-14 15:12:54 +02:00
|
|
|
var messages_out = 0;
|
|
|
|
var messages_in = 0;
|
|
|
|
var start_time = new Date().getTime();
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
var receive_server = http.createServer(function(request, response) {
|
|
|
|
response.writeHead(200, {'Content-Type' : 'text/plain'});
|
|
|
|
|
2012-06-14 15:12:54 +02:00
|
|
|
// Publishing a notification.
|
|
|
|
if (request.method == 'POST') {
|
2012-06-12 02:49:32 +02:00
|
|
|
var body = '';
|
|
|
|
|
|
|
|
request.on('data', function (data) {
|
|
|
|
body += data;
|
|
|
|
});
|
|
|
|
|
|
|
|
request.on('end', function () {
|
2012-06-14 15:12:54 +02:00
|
|
|
++messages_in;
|
|
|
|
|
2012-06-12 02:49:32 +02:00
|
|
|
var data = querystring.parse(body);
|
|
|
|
log('notification: ' + JSON.stringify(data));
|
|
|
|
broadcast(data);
|
|
|
|
response.end();
|
|
|
|
});
|
2012-06-14 15:12:54 +02:00
|
|
|
} else if (request.url == '/status/') {
|
2013-04-12 00:45:50 +02:00
|
|
|
request.on('data', function(data) {
|
|
|
|
// We just ignore the request data, but newer versions of Node don't
|
|
|
|
// get to 'end' if we don't process the data. See T2953.
|
|
|
|
});
|
|
|
|
|
2012-06-14 15:12:54 +02:00
|
|
|
request.on('end', function() {
|
|
|
|
var status = {
|
|
|
|
'uptime': (new Date().getTime() - start_time),
|
|
|
|
'clients.active': current_connections,
|
|
|
|
'clients.total': generate_id.current_id || 0,
|
|
|
|
'messages.in': messages_in,
|
|
|
|
'messages.out': messages_out,
|
|
|
|
'log': config.log
|
|
|
|
};
|
|
|
|
|
|
|
|
response.write(JSON.stringify(status));
|
|
|
|
response.end();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
response.statusCode = 400;
|
|
|
|
response.write('400 Bad Request');
|
|
|
|
response.end();
|
2012-06-12 02:49:32 +02:00
|
|
|
}
|
2012-06-14 15:12:54 +02:00
|
|
|
|
2012-12-20 00:19:23 +01:00
|
|
|
}).listen(config.admin, config.host);
|
2012-06-12 02:49:32 +02:00
|
|
|
|
|
|
|
function broadcast(data) {
|
2012-06-14 15:12:54 +02:00
|
|
|
for (var client_id in clients) {
|
2012-06-12 02:49:32 +02:00
|
|
|
try {
|
|
|
|
write_json(clients[client_id], data);
|
2012-06-14 15:12:54 +02:00
|
|
|
++messages_out;
|
|
|
|
log('wrote to client ' + client_id);
|
2012-06-12 02:49:32 +02:00
|
|
|
} catch (error) {
|
|
|
|
delete clients[client_id];
|
|
|
|
current_connections--;
|
2012-06-14 15:12:54 +02:00
|
|
|
log('ERROR: could not write to client ' + client_id);
|
2012-06-12 02:49:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:12:54 +02:00
|
|
|
// If we're configured to drop permissions, get rid of them now that we've
|
|
|
|
// bound to the ports we need and opened logfiles.
|
|
|
|
if (config.user) {
|
|
|
|
process.setuid(config.user);
|
|
|
|
}
|
|
|
|
|