From 1e84102aae466dc550e4ea1f4678525b36021fc4 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Mon, 16 May 2016 19:44:15 -0400 Subject: [PATCH] loolwsd: MasterProcessSession splitting: move edit lock Change-Id: I8339f28cb9ed0ed1a5b1f4cf38d6083450cb4fdc Reviewed-on: https://gerrit.libreoffice.org/25045 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loolwsd/ClientSession.cpp | 4 ++-- loolwsd/ClientSession.hpp | 6 +++--- loolwsd/MasterProcessSession.cpp | 8 -------- loolwsd/MasterProcessSession.hpp | 9 --------- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp index b4b82058b..3676aa005 100644 --- a/loolwsd/ClientSession.cpp +++ b/loolwsd/ClientSession.cpp @@ -225,7 +225,7 @@ bool ClientSession::getStatus(const char *buffer, int length) forwardToPeer(buffer, length); return true; } -/* + void ClientSession::setEditLock(const bool value) { // Update the sate and forward to child. @@ -233,7 +233,7 @@ void ClientSession::setEditLock(const bool value) const auto msg = std::string("editlock: ") + (value ? "1" : "0"); forwardToPeer(msg.data(), msg.size()); } -*/ + bool ClientSession::getCommandValues(const char *buffer, int length, StringTokenizer& tokens) { std::string command; diff --git a/loolwsd/ClientSession.hpp b/loolwsd/ClientSession.hpp index 13692c277..7ef2dfa2e 100644 --- a/loolwsd/ClientSession.hpp +++ b/loolwsd/ClientSession.hpp @@ -28,9 +28,9 @@ public: virtual ~ClientSession(); - //void setEditLock(const bool value); - //void markEditLock(const bool value) { _bEditLock = value; } - //bool isEditLocked() const { return _bEditLock; } + void setEditLock(const bool value); + void markEditLock(const bool value) { _bEditLock = value; } + bool isEditLocked() const { return _bEditLock; } void setPeer(const std::shared_ptr& peer) { MasterProcessSession::_peer = _peer = peer; } diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index 9c491bbb6..988883218 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -49,14 +49,6 @@ MasterProcessSession::~MasterProcessSession() { } -void MasterProcessSession::setEditLock(const bool value) -{ - // Update the sate and forward to child. - _bEditLock = value; - const auto msg = std::string("editlock: ") + (value ? "1" : "0"); - forwardToPeer(msg.data(), msg.size()); -} - void MasterProcessSession::dispatchChild() { std::ostringstream oss; diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp index cc3debe44..92f2484ce 100644 --- a/loolwsd/MasterProcessSession.hpp +++ b/loolwsd/MasterProcessSession.hpp @@ -33,10 +33,6 @@ class MasterProcessSession : public LOOLSession, public std::enable_shared_from_ std::shared_ptr getQueue() const { return _queue; } - void setEditLock(const bool value); - void markEditLock(const bool value) { _bEditLock = value; } - bool isEditLocked() const { return _bEditLock; } - bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message); protected: @@ -56,11 +52,6 @@ class MasterProcessSession : public LOOLSession, public std::enable_shared_from_ int _loadPart; std::shared_ptr _docBroker; std::shared_ptr _queue; - - // If this document holds the edit lock. - // An edit lock will only allow the current session to make edits, - // while other session opening the same document can only see - bool _bEditLock = false; }; #endif