wsd/ClientSession.cpp | 29 ++++++++++++----------------- wsd/ClientSession.hpp | 11 +++-------- 2 files changed, 15 insertions(+), 25 deletions(-)
New commits: commit 664f602555dac15a6333943b8f9a0d21f29f659d Author: Ashod Nakashian <[email protected]> Date: Sat Jan 21 22:32:00 2017 -0500 wsd: cleanup ClientSession Change-Id: Ia5d138ed7baf4c26982e93157d82e332cd049a60 Reviewed-on: https://gerrit.libreoffice.org/33435 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 87bc072..12b8fb8 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -37,8 +37,6 @@ ClientSession::ClientSession(const std::string& id, _uriPublic(uriPublic), _isReadOnly(readOnly), _isDocumentOwner(false), - _loadPart(-1), - _isLoadRequested(false), _stop(false) { LOG_INF("ClientSession ctor [" << getName() << "]."); @@ -57,11 +55,6 @@ ClientSession::~ClientSession() } } -bool ClientSession::isLoaded() const -{ - return _isLoadRequested && gotStatus(); -} - bool ClientSession::_handleInput(const char *buffer, int length) { LOG_TRC(getName() << ": handling [" << getAbbreviatedMessage(buffer, length) << "]."); @@ -239,7 +232,8 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/, try { std::string timestamp; - parseDocOptions(tokens, _loadPart, timestamp); + int loadPart = -1; + parseDocOptions(tokens, loadPart, timestamp); std::ostringstream oss; oss << "load"; @@ -257,21 +251,22 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/, oss << " author=" + encodedUserName; } - if (_loadPart >= 0) - oss << " part=" + std::to_string(_loadPart); + if (loadPart >= 0) + { + oss << " part=" << loadPart; + } if (_haveDocPassword) + { oss << " password=" << _docPassword; + } if (!_docOptions.empty()) - oss << " options=" << _docOptions; - - const auto loadRequest = oss.str(); - if (forwardToChild(loadRequest, docBroker)) { - _isLoadRequested = true; - return true; + oss << " options=" << _docOptions; } + + return forwardToChild(oss.str(), docBroker); } catch (const Poco::SyntaxException&) { @@ -607,7 +602,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt } else if (tokens[0] == "status:") { - _gotStatus = true; + _isLoaded = true; docBroker->setLoaded(); // Forward the status response to the client. diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp index 96fd0f7..706fae1 100644 --- a/wsd/ClientSession.hpp +++ b/wsd/ClientSession.hpp @@ -34,10 +34,8 @@ public: void setReadOnly(); bool isReadOnly() const { return _isReadOnly; } - /// Returns true if we've got status message. - bool gotStatus() const { return _gotStatus; } - - bool isLoaded() const; + /// Returns true if a document is loaded (i.e. we got status message). + bool isLoaded() const { return _isLoaded; } const std::string getUserId() const { return _userId; } void setUserId(const std::string& userId) { _userId = userId; } @@ -165,10 +163,7 @@ private: /// Store URLs of completed 'save as' documents. MessageQueue _saveAsQueue; - int _loadPart; - - bool _isLoadRequested; - bool _gotStatus; + bool _isLoaded; /// Wopi FileInfo object std::unique_ptr<WopiStorage::WOPIFileInfo> _wopiFileInfo; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
