Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/node/handler/PadMessageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ exports.handleMessage = function(client, message)
{
return;
}
if(!sessioninfos[client.id]) {
var thisSession = sessioninfos[client.id]
if(!thisSession) {
messageLogger.warn("Dropped message from an unknown connection.")
return;
}
Expand Down Expand Up @@ -196,7 +197,7 @@ exports.handleMessage = function(client, message)
} else if(message.type == "CHANGESET_REQ") {
handleChangesetRequest(client, message);
} else if(message.type == "COLLABROOM") {
if (sessioninfos[client.id].readonly) {
if (thisSession.readonly) {
messageLogger.warn("Dropped message, COLLABROOM for readonly pad");
} else if (message.data.type == "USER_CHANGES") {
stats.counter('pendingEdits').inc()
Expand Down Expand Up @@ -588,6 +589,14 @@ function handleUserChanges(data, cb)
messageLogger.warn("Dropped message, USER_CHANGES Message has no changeset!");
return cb();
}
//TODO: this might happen with other messages too => find one place to copy the session
//and always use the copy. atm a message will be ignored if the session is gone even
//if the session was valid when the message arrived in the first place
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could store the session in the queue alongside the other stuff, but I think we might run into errors as the session would be invalid, still.

if(!sessioninfos[client.id])
{
messageLogger.warn("Dropped message, disconnect happened in the mean time");
return cb();
}

//get all Vars we need
var baseRev = message.data.baseRev;
Expand Down