Do a reconnect on network problems. After 10s it gives up

This commit is contained in:
Peter 'Pita' Martischka 2011-11-25 15:24:10 -08:00
parent 53bf7dc19d
commit fa098d73cd
5 changed files with 80 additions and 203 deletions

View file

@ -806,8 +806,20 @@ function handleClientReady(client, message)
clientVars.userName = authorName;
}
//Send the clientVars to the Client
client.json.send(clientVars);
//This is a reconnect, so 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(clientVars);
//Save the revision in sessioninfos
sessioninfos[client.id].rev = pad.getHeadRevisionNumber();
}
//Save the revision and the author id in sessioninfos
sessioninfos[client.id].rev = pad.getHeadRevisionNumber();