1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-22 23:38:48 -05:00

[WO-594] Return own hostname for 'hostname' call from socket.io

This commit is contained in:
Andris Reinman 2014-10-14 13:51:52 +03:00
parent 315a471f10
commit 66ddac2c71

View File

@ -5,6 +5,7 @@ process.chdir(__dirname);
var cluster = require('cluster'); var cluster = require('cluster');
var config = require('config'); var config = require('config');
var log = require('npmlog'); var log = require('npmlog');
var os = require('os');
log.level = config.log.level; log.level = config.log.level;
@ -176,6 +177,10 @@ io.on('connection', function(socket) {
log.info('io', 'Closed connection [%s]', socket.conn.id); log.info('io', 'Closed connection [%s]', socket.conn.id);
socket.removeAllListeners(); socket.removeAllListeners();
}); });
socket.on('hostname', function(fn) {
fn(os.hostname());
});
}); });
// //