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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 16 01:55:28 UTC 2017


 wsd/DocumentBroker.cpp |    4 ++--
 wsd/LOOLWSD.cpp        |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 1c67d9387f026b0da814b4e3422bf42185cdcfa3
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Jan 10 17:10:10 2017 -0500

    wsd: addSession now must be called under lock
    
    Change-Id: I6148d7ac3edd88f922d258f39ea22b372dba84f0
    Reviewed-on: https://gerrit.libreoffice.org/33124
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 4348e86..7d7bfee 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -594,11 +594,11 @@ std::string DocumentBroker::getJailRoot() const
 
 size_t DocumentBroker::addSession(std::shared_ptr<ClientSession>& session)
 {
+    Util::assertIsLocked(_mutex);
+
     const auto id = session->getId();
     const std::string aMessage = "session " + id + " " + _docKey;
 
-    std::unique_lock<std::mutex> lock(_mutex);
-
     try
     {
         // First load the document, since this can fail.
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ca03df2..889b817 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -608,7 +608,9 @@ private:
                     std::shared_ptr<LOOLWebSocket> ws;
                     auto session = std::make_shared<ClientSession>(id, ws, docBroker, uriPublic);
 
+                    auto lock = docBroker->getLock();
                     auto sessionsCount = docBroker->addSession(session);
+                    lock.unlock();
                     LOG_TRC(docKey << ", ws_sessions++: " << sessionsCount);
 
                     docBrokersLock.unlock();


More information about the Libreoffice-commits mailing list