From 18f90866aeb9b2e04ba57728839feafe9549bfe0 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 4 Dec 2011 22:01:49 +0100 Subject: [PATCH] fixed reconnect --- node/handler/PadMessageHandler.js | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/node/handler/PadMessageHandler.js b/node/handler/PadMessageHandler.js index 280e9492f..d86528498 100644 --- a/node/handler/PadMessageHandler.js +++ b/node/handler/PadMessageHandler.js @@ -808,23 +808,26 @@ function handleClientReady(client, message) clientVars.userName = authorName; } - //This is a reconnect, so we don't have to send the client the ClientVars again - if(message.reconnect == true) + if(sessioninfos[client.id] !== undefined) { - //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 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].author = author; } - //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].author = author; //prepare the notification for the other users on the pad, that this user joined var messageToTheOtherUsers = {