loolwsd: disable editlock in multiview

Change-Id: I4df2d8a321e160ce226c2e22aa754cd6e5b2c755
Reviewed-on: https://gerrit.libreoffice.org/25063
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-05-17 08:17:21 -04:00 committed by Ashod Nakashian
parent b41f0a6ea3
commit 76991dd325
3 changed files with 10 additions and 9 deletions

View file

@ -40,7 +40,7 @@ ClientSession::ClientSession(const std::string& id,
LOOLSession(id, Kind::ToClient, ws), LOOLSession(id, Kind::ToClient, ws),
_docBroker(docBroker), _docBroker(docBroker),
_queue(queue), _queue(queue),
_haveEditLock(false), _haveEditLock(std::getenv("LOK_VIEW_CALLBACK")),
_loadFailed(false), _loadFailed(false),
_loadPart(-1) _loadPart(-1)
{ {
@ -222,10 +222,9 @@ bool ClientSession::getStatus(const char *buffer, int length)
sendTextFrame(status); sendTextFrame(status);
// And let clients know if they hold the edit lock. // And let clients know if they hold the edit lock.
std::string message = "editlock: "; const auto msg = "editlock: " + std::to_string(isEditLocked());
message += std::to_string(isEditLocked()); Log::debug("Returning [" + msg + "] in response to status.");
Log::debug("Forwarding [" + message + "] in response to status."); sendTextFrame(msg);
sendTextFrame(message);
return true; return true;
} }
@ -243,8 +242,10 @@ bool ClientSession::getStatus(const char *buffer, int length)
void ClientSession::setEditLock(const bool value) void ClientSession::setEditLock(const bool value)
{ {
// Update the sate and forward to child. // Update the sate and forward to child.
_haveEditLock = value; markEditLock(value);
const auto msg = std::string("editlock: ") + (value ? "1" : "0"); const auto msg = "editlock: " + std::to_string(isEditLocked());
const auto mv = std::getenv("LOK_VIEW_CALLBACK") ? "1" : "0";
Log::debug("Forwarding [" + msg + "] to set editlock to " + std::to_string(value) + ". MultiView: " + mv);
forwardToPeer(msg.data(), msg.size()); forwardToPeer(msg.data(), msg.size());
} }

View file

@ -27,7 +27,7 @@ public:
virtual ~ClientSession(); virtual ~ClientSession();
void setEditLock(const bool value); void setEditLock(const bool value);
void markEditLock(const bool value) { _haveEditLock = value; } void markEditLock(const bool value) { _haveEditLock = (value || std::getenv("LOK_VIEW_CALLBACK")); }
bool isEditLocked() const { return _haveEditLock; } bool isEditLocked() const { return _haveEditLock; }
void setPeer(const std::shared_ptr<PrisonerSession>& peer) { _peer = peer; } void setPeer(const std::shared_ptr<PrisonerSession>& peer) { _peer = peer; }

View file

@ -275,7 +275,7 @@ bool DocumentBroker::sendUnoSave()
Log::info("Autosave triggered for doc [" + _docKey + "]."); Log::info("Autosave triggered for doc [" + _docKey + "].");
Util::assertIsLocked(_mutex); Util::assertIsLocked(_mutex);
// Save using session holding the edit-lock // Save using session holding the edit-lock (or first if multview).
for (auto& sessionIt: _sessions) for (auto& sessionIt: _sessions)
{ {
if (sessionIt.second->isEditLocked()) if (sessionIt.second->isEditLocked())