From ef54b6ea167471ba5dc50947bc071a4c5f58c43f Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Fri, 11 Aug 2017 23:10:34 +0530 Subject: [PATCH] wsd: Ignore useractive, userinactive when doc is not loaded Sometimes client sends a userinactive message while the document is already being loaded, which leads to the kit process skipping sending the result of LOK callbacks to the client. Handling this in child session is futile in the case when userinactive message is sent when the document is being loaded, since kit process handles the 'userinactive' message only after document is loaded (i.e isLoaded() returns true). Moving this handling to DocumentBroker will take care of both the cases - when 'userinactive' is sent before load starts, and during load of the document. Change-Id: I4ea3ac7b184d2ca373eb3ff4fb7b4ae394d454df --- kit/ChildSession.cpp | 7 ------- wsd/DocumentBroker.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index 0a4a59e4e..49cfde06d 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -183,13 +183,6 @@ bool ChildSession::_handleInput(const char *buffer, int length) } else if (!_isDocLoaded) { - // Be forgiving to these messages while we load. - if (tokens[0] == "useractive" || - tokens[0] == "userinactive") - { - return true; - } - sendTextFrame("error: cmd=" + tokens[0] + " kind=nodocloaded"); return false; } diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 84fddd689..f697c6630 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -1316,6 +1316,12 @@ bool DocumentBroker::forwardToChild(const std::string& viewId, const std::string { assertCorrectThread(); + // Ignore userinactive, useractive message until document is loaded + if (!isLoaded() && (message == "userinactive" || message == "useractive")) + { + return true; + } + LOG_TRC("Forwarding payload to child [" << viewId << "]: " << message); std::string msg = "child-" + viewId + ' ' + message;