From 07ae44ddf4f2fd77ce04ab9a9e3cb405fe032806 Mon Sep 17 00:00:00 2001 From: Ray Bellis Date: Thu, 31 Jan 2019 15:46:25 +0000 Subject: [PATCH] PadMessageHandler.js: cope better with session disconnects --- src/node/handler/PadMessageHandler.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index b41af86b9..cccb9e8a2 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -268,6 +268,12 @@ exports.handleMessage = async function(client, message) // FIXME: Use a hook instead // FIXME: Allow to override readwrite access with readonly + // the session may have been dropped during earlier processing + if (!sessioninfos[client.id]) { + messageLogger.warn("Dropping message from a connection that has gone away.") + return; + } + // Simulate using the load testing tool if (!sessioninfos[client.id].auth) { console.error("Auth was never applied to a session. If you are using the stress-test tool then restart Etherpad and the Stress test tool.")