fixed reconnect

pull/128/merge
Peter 'Pita' Martischka 2011-12-04 22:01:49 +01:00
parent 16e4fa9959
commit 18f90866ae
1 changed files with 18 additions and 15 deletions

View File

@ -808,23 +808,26 @@ function handleClientReady(client, message)
clientVars.userName = authorName; clientVars.userName = authorName;
} }
//This is a reconnect, so we don't have to send the client the ClientVars again if(sessioninfos[client.id] !== undefined)
if(message.reconnect == true)
{ {
//Save the revision in sessioninfos, we take the revision from the info the client send to us //This is a reconnect, so we don't have to send the client the ClientVars again
sessioninfos[client.id].rev = message.client_rev; if(message.reconnect == true)
} {
//This is a normal first connect //Save the revision in sessioninfos, we take the revision from the info the client send to us
else sessioninfos[client.id].rev = message.client_rev;
{ }
//Send the clientVars to the Client //This is a normal first connect
client.json.send(clientVars); else
//Save the revision in sessioninfos {
sessioninfos[client.id].rev = pad.getHeadRevisionNumber(); //Send the clientVars to the Client
} client.json.send(clientVars);
//Save the revision in sessioninfos
sessioninfos[client.id].rev = pad.getHeadRevisionNumber();
}
//Save the revision and the author id in sessioninfos //Save the revision and the author id in sessioninfos
sessioninfos[client.id].author = author; sessioninfos[client.id].author = author;
}
//prepare the notification for the other users on the pad, that this user joined //prepare the notification for the other users on the pad, that this user joined
var messageToTheOtherUsers = { var messageToTheOtherUsers = {