Only create clientVars when they are needed

This commit is contained in:
mluto 2013-01-14 22:08:33 +01:00
parent 025c92f346
commit 94f9b05c4c

View file

@ -991,6 +991,15 @@ function handleClientReady(client, message)
//Saves in pad2sessions that this session belongs to this pad
pad2sessions[padIds.padId].push(client.id);
//If this is a reconnect, we don't have to send the client the ClientVars again
if(message.reconnect == true)
{
//Save the revision in sessioninfos, we take the revision from the info the client send to us
sessioninfos[client.id].rev = message.client_rev;
}
//This is a normal first connect
else
{
//prepare all values for the wire
var atext = Changeset.cloneAText(pad.atext);
var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool);
@ -1012,7 +1021,6 @@ function handleClientReady(client, message)
"collab_client_vars": {
"initialAttributedText": atext,
"clientIp": "127.0.0.1",
//"clientAgent": "Anonymous Agent",
"padId": message.padId,
"historicalAuthorData": historicalAuthorData,
"apool": apool,
@ -1055,15 +1063,6 @@ function handleClientReady(client, message)
clientVars.userName = authorName;
}
//If this is a reconnect, we don't have to send the client the ClientVars again
if(message.reconnect == true)
{
//Save the revision in sessioninfos, we take the revision from the info the client send to us
sessioninfos[client.id].rev = message.client_rev;
}
//This is a normal first connect
else
{
//Send the clientVars to the Client
client.json.send({type: "CLIENT_VARS", data: clientVars});
//Save the current revision in sessioninfos, should be the same as in clientVars