mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
cluster sticky session
This commit is contained in:
@@ -124,7 +124,9 @@ if(nconf.get('ssl')) {
|
||||
|
||||
module.exports.listen = function(callback) {
|
||||
var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port;
|
||||
|
||||
if (cluster.isWorker) {
|
||||
port = 0;
|
||||
}
|
||||
server.listen(port, nconf.get('bind_address'), function(err) {
|
||||
if (err) {
|
||||
winston.info('NodeBB was unable to listen on: ' + bind_address);
|
||||
@@ -144,4 +146,13 @@ if(nconf.get('ssl')) {
|
||||
});
|
||||
};
|
||||
|
||||
process.on('message', function(message, connection) {
|
||||
if (!message || message.action !== 'sticky-session:connection') {
|
||||
return;
|
||||
}
|
||||
|
||||
server.emit('connection', connection);
|
||||
process.send({action: 'sticky-session:accept', handleIndex: message.handleIndex});
|
||||
});
|
||||
|
||||
}(WebServer));
|
||||
|
||||
Reference in New Issue
Block a user