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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Tue May 10 03:45:56 UTC 2016


 loolwsd/DocumentBroker.cpp |   10 ++++++++--
 loolwsd/LOOLWSD.cpp        |    1 -
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit e2f5f4514065385ffa8d24efa51f41217d140319
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon May 9 21:18:58 2016 -0400

    loolwsd: remove mark-to-destory when we no longer have a sole client
    
    Change-Id: Ic82176c458165faa1f719d313cc7fe0b4e6eacbb
    Reviewed-on: https://gerrit.libreoffice.org/24812
    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 764c6ab..9a4db8a 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -223,7 +223,7 @@ bool DocumentBroker::autoSave(const bool force, const size_t waitTimeoutMs)
 
     // Remeber the last save time, since this is the predicate.
     const auto lastSaveTime = _lastSaveTime;
-    Log::trace("Autosaving [" + _docKey + "].");
+    Log::trace("Checking to autosave [" + _docKey + "].");
 
     bool sent = false;
     if (force)
@@ -292,6 +292,7 @@ bool DocumentBroker::sendUnoSave()
                 {
                     queue->put("uno .uno:SetInputMode");
                 }
+
                 return true;
             }
         }
@@ -322,11 +323,11 @@ void DocumentBroker::takeEditLock(const std::string& id)
 size_t DocumentBroker::addSession(std::shared_ptr<MasterProcessSession>& session)
 {
     const auto id = session->getId();
+    const std::string aMessage = "session " + id + " " + _docKey + "\n";
 
     std::lock_guard<std::mutex> lock(_mutex);
 
     // 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));
     _childProcess->getWebSocket()->sendFrame(aMessage.data(), aMessage.size());
 
@@ -341,6 +342,11 @@ size_t DocumentBroker::addSession(std::shared_ptr<MasterProcessSession>& session
         Log::debug("Giving editing lock to the first session [" + id + "].");
         _sessions.begin()->second->markEditLock(true);
     }
+    else
+    {
+        assert(_sessions.size() > 1);
+        _markToDestroy = false;
+    }
 
     return _sessions.size();
 }
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 6aee539..787cb7a 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -539,7 +539,6 @@ private:
                 docBroker = it->second;
                 assert(docBroker);
             }
-            docBrokersLock.unlock();
         }
 
         if (docBroker)


More information about the Libreoffice-commits mailing list