identify which parts are causing issues and comment them out, obviously this needs fixing

This commit is contained in:
John McLear 2014-11-04 17:57:18 +00:00
parent 2c801cc558
commit 1e53c4f5f0
2 changed files with 11 additions and 3 deletions

View File

@ -1015,6 +1015,7 @@ function handleClientReady(client, message)
return callback(); return callback();
//Check if this author is already on the pad, if yes, kick the other sessions! //Check if this author is already on the pad, if yes, kick the other sessions!
/*
var roomClients = socketio.sockets.clients(padIds.padId); var roomClients = socketio.sockets.clients(padIds.padId);
for(var i = 0; i < roomClients.length; i++) { for(var i = 0; i < roomClients.length; i++) {
var sinfo = sessioninfos[roomClients[i].id]; var sinfo = sessioninfos[roomClients[i].id];
@ -1025,6 +1026,7 @@ function handleClientReady(client, message)
roomClients[i].json.send({disconnect:"userdup"}); roomClients[i].json.send({disconnect:"userdup"});
} }
} }
*/
//Save in sessioninfos that this session belonges to this pad //Save in sessioninfos that this session belonges to this pad
sessioninfos[client.id].padId = padIds.padId; sessioninfos[client.id].padId = padIds.padId;
@ -1032,6 +1034,7 @@ function handleClientReady(client, message)
sessioninfos[client.id].readonly = padIds.readonly; sessioninfos[client.id].readonly = padIds.readonly;
//Log creation/(re-)entering of a pad //Log creation/(re-)entering of a pad
/*
client.get('remoteAddress', function(er, ip) { client.get('remoteAddress', function(er, ip) {
//Anonymize the IP address if IP logging is disabled //Anonymize the IP address if IP logging is disabled
if(settings.disableIPlogging) { if(settings.disableIPlogging) {
@ -1045,6 +1048,7 @@ function handleClientReady(client, message)
accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad'); accessLogger.info('[CREATE] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" created the pad');
} }
}) })
*/
//If this is a reconnect, we don't have to send the client the ClientVars again //If this is a reconnect, we don't have to send the client the ClientVars again
if(message.reconnect == true) if(message.reconnect == true)
@ -1100,7 +1104,7 @@ function handleClientReady(client, message)
// tell the client the number of the latest chat-message, which will be // tell the client the number of the latest chat-message, which will be
// used to request the latest 100 chat-messages later (GET_CHAT_MESSAGES) // used to request the latest 100 chat-messages later (GET_CHAT_MESSAGES)
"chatHead": pad.chatHead, "chatHead": pad.chatHead,
"numConnectedUsers": roomClients.length, "numConnectedUsers": 0,
"readOnlyId": padIds.readOnlyPadId, "readOnlyId": padIds.readOnlyPadId,
"readonly": padIds.readonly, "readonly": padIds.readonly,
"serverTimestamp": new Date().getTime(), "serverTimestamp": new Date().getTime(),
@ -1165,6 +1169,7 @@ function handleClientReady(client, message)
client.broadcast.to(padIds.padId).json.send(messageToTheOtherUsers); client.broadcast.to(padIds.padId).json.send(messageToTheOtherUsers);
//Run trough all sessions of this pad //Run trough all sessions of this pad
/*
async.forEach(socketio.sockets.clients(padIds.padId), function(roomClient, callback) async.forEach(socketio.sockets.clients(padIds.padId), function(roomClient, callback)
{ {
var author; var author;
@ -1211,6 +1216,7 @@ function handleClientReady(client, message)
} }
], callback); ], callback);
}, callback); }, callback);
*/
} }
],function(err) ],function(err)
{ {

View File

@ -56,11 +56,13 @@ exports.setSocketIO = function(_socket) {
socket.sockets.on('connection', function(client) socket.sockets.on('connection', function(client)
{ {
// Broken: See http://stackoverflow.com/questions/4647348/send-message-to-specific-client-with-socket-io-and-node-js
if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){ if(settings.trustProxy && client.handshake.headers['x-forwarded-for'] !== undefined){
client.set('remoteAddress', client.handshake.headers['x-forwarded-for']); // client.set('remoteAddress', client.handshake.headers['x-forwarded-for']);
} }
else{ else{
client.set('remoteAddress', client.handshake.address.address); // client.set('remoteAddress', client.handshake.address);
} }
var clientAuthorized = false; var clientAuthorized = false;