this.real_address = this.websocket.handshake.real_address;
// A hash to identify this client instance
- this.hash = crypto.createHash('sha256').update(this.real_address).update('' + Date.now()).digest('hex');
+ this.hash = crypto.createHash('sha256')
+ .update(this.real_address)
+ .update('' + Date.now())
+ .update(Math.floor(Math.random() * 100000).toString())
+ .digest('hex');
this.irc_connections = [];
this.next_connection = 0;
irc_commands.bindEvents();
con.on('connected', function () {
- console.log("con.on('connected')");
return callback(null, con_num);
});
con.on('error', function (err) {
+ console.log('irc_connection error (' + command.hostname + '):', err);
// TODO: Once multiple servers implemented, specify which server failed
//that.sendKiwiCommand('error', {server: con_num, error: err});
return callback(err.code, null);
};
IrcConnection.prototype.end = function (data, callback) {
- console.log('Closing IRC socket');
end.call(this, data + '\r\n', 'utf-8', callback);
};
this.write('USER ' + connect_data.username + ' 0 0 :' + connect_data.realname);
this.connected = true;
- console.log("IrcConnection.emit('connected')");
this.emit('connected');
};