Merge pull request #341 from azul/race_condition

make PadMessageHandler more robust against timing issues
pull/342/merge
Peter 'Pita' Martischka 2012-01-22 06:25:35 -08:00
commit 165f26947d
1 changed files with 10 additions and 2 deletions

View File

@ -516,7 +516,12 @@ exports.updatePadClients = function(pad, callback)
], function(err)
{
if(ERR(err, callback)) return;
// next if session has not been deleted
if(sessioninfos[session] == null)
{
callback(null);
return;
}
if(author == sessioninfos[session].author)
{
socketio.sockets.sockets[session].json.send({"type":"COLLABROOM","data":{type:"ACCEPT_COMMIT", newRev:r}});
@ -538,7 +543,10 @@ exports.updatePadClients = function(pad, callback)
callback
);
sessioninfos[session].rev = pad.getHeadRevisionNumber();
if(sessioninfos[session] != null)
{
sessioninfos[session].rev = pad.getHeadRevisionNumber();
}
},callback);
}