[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Apr 11 03:10:32 UTC 2016


 loolwsd/DocumentBroker.cpp |    6 ++++++
 loolwsd/LOOLWSD.cpp        |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 1c0f608a590bb86d392fb22801aca6842562ab0e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 10 13:35:06 2016 -0400

    loolwsd: broker sets edit lock on first session automatically
    
    Change-Id: Icad57130ffb1953cf8c71d4675c116036684569a
    Reviewed-on: https://gerrit.libreoffice.org/23977
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 9f8d37a..b2d93f1 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -230,6 +230,12 @@ void DocumentBroker::addWSSession(const std::string id, std::shared_ptr<MasterPr
         Log::warn("DocumentBroker: Trying to add already existed session.");
     }
 
+    if (_wsSessions.size() == 1)
+    {
+        ws->setEditLock(true);
+        ws->sendTextFrame("editlock: 1");
+    }
+
     // Request a new session from the child kit.
     const std::string aMessage = "session " + id + " " + _docKey + "\n";
     Log::debug("DocBroker to Child: " + aMessage.substr(0, aMessage.length() - 1));
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 823775d..989c3f7 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -343,7 +343,6 @@ private:
                     docBroker->addWSSession(id, session);
                     auto wsSessionsCount = docBroker->getWSSessionsCount();
                     Log::trace(docKey + ", ws_sessions++: " + std::to_string(wsSessionsCount));
-                    session->setEditLock(true);
                     lock.unlock();
 
                     if (!waitBridgeCompleted(session, docBroker))
@@ -554,10 +553,6 @@ private:
         docBroker->addWSSession(id, session);
         auto wsSessionsCount = docBroker->getWSSessionsCount();
         Log::trace(docKey + ", ws_sessions++: " + std::to_string(wsSessionsCount));
-        if (wsSessionsCount == 1)
-        {
-            session->setEditLock(true);
-        }
         docBrokersLock.unlock();
 
         if (!waitBridgeCompleted(session, docBroker))


More information about the Libreoffice-commits mailing list