summaryrefslogtreecommitdiff
path: root/src/node/handler
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2014-03-26 19:39:19 +0000
committerJohn McLear <john@mclear.co.uk>2014-03-26 19:39:19 +0000
commit56fd078469fafa10cd5c706ab36f4165b925ae93 (patch)
treeaced4cba4f79c390592d1965aea6f712d00eb610 /src/node/handler
parente23af7e43999b976129379ee8f995f95512050c3 (diff)
parentfa681d43f7c10f4ac22a2c394e26aa09f9792a57 (diff)
downloadetherpad-lite-56fd078469fafa10cd5c706ab36f4165b925ae93.zip
Merge pull request #2092 from webzwo0i/fix-crash-with-queued-messages
Fix crash with queued messages
Diffstat (limited to 'src/node/handler')
-rw-r--r--src/node/handler/PadMessageHandler.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index 3582c9bd..26eb17a6 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -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;
}
@@ -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()
@@ -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
+ 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;