Skip to content

Commit

Permalink
Fixing a bug that happens when a socket.io connection closes very ear…
Browse files Browse the repository at this point in the history
…ly after a CLIENT_READY message
  • Loading branch information
Pita committed Oct 19, 2011
1 parent e0cf609 commit 0f55934
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions node/handler/PadMessageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,15 @@ function handleClientReady(client, message)
//Send the clientVars to the Client
client.json.send(clientVars);

//Save the revision and the author id in sessioninfos
sessioninfos[client.id].rev = pad.getHeadRevisionNumber();
sessioninfos[client.id].author = author;

//sometimes the client disconnects very early and the session of it is already removed
//thats why we have to check that case
if(sessioninfos[client.id] !== undefined)
{
//Save the revision and the author id in sessioninfos
sessioninfos[client.id].rev = pad.getHeadRevisionNumber();
sessioninfos[client.id].author = author;
}

//prepare the notification for the other users on the pad, that this user joined
var messageToTheOtherUsers = {
"type": "COLLABROOM",
Expand Down

0 comments on commit 0f55934

Please sign in to comment.