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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Apr 24 16:57:28 UTC 2016


 loolwsd/ChildProcessSession.cpp |    2 +-
 loolwsd/DocumentBroker.cpp      |    4 ++--
 loolwsd/DocumentBroker.hpp      |    6 +++---
 loolwsd/LOKitHelper.hpp         |    2 +-
 loolwsd/LOOLWSD.cpp             |   13 +++++++------
 5 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 08222c791f42a531359f3cd0cdcf28161f1f7bfa
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 24 11:08:08 2016 -0400

    loolwsd: cosmetics
    
    Change-Id: Ic5398c2ccacad24bef898ba502e5bd1bb0f26c00
    Reviewed-on: https://gerrit.libreoffice.org/24334
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 92435ba..406a4a3 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -92,7 +92,7 @@ public:
 
         if (_session.isCloseFrame())
         {
-            Log::trace("LOKit document begin the closing handshake");
+            Log::trace("Skipping callback on closing session " + _session.getName());
             return;
         }
         else if (_session.isDisconnected())
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index b749f77..84b2a32 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -71,8 +71,8 @@ DocumentBroker::DocumentBroker(const Poco::URI& uriPublic,
     _docKey(docKey),
     _childRoot(childRoot),
     _cacheRoot(getCachePath(uriPublic.toString())),
-    _lastSaveTime(std::chrono::steady_clock::now()),
     _childProcess(childProcess),
+    _lastSaveTime(std::chrono::steady_clock::now()),
     _markToDestroy(false),
     _isModified(false)
 {
@@ -275,7 +275,7 @@ size_t DocumentBroker::addSession(std::shared_ptr<MasterProcessSession>& session
     auto ret = _sessions.emplace(id, session);
     if (!ret.second)
     {
-        Log::warn("DocumentBroker: Trying to add already existed session.");
+        Log::warn("DocumentBroker: Trying to add already existing session.");
     }
 
     if (_sessions.size() == 1)
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 3c39b24..9129fec 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -133,6 +133,8 @@ public:
     bool load(const std::string& jailId);
 
     bool save();
+    bool isModified() const { return _isModified; }
+    void setModified(const bool value);
 
     /// Save the document if there was activity since last save.
     /// force when true, will force saving immediatly, regardless
@@ -177,14 +179,13 @@ public:
     // Called when the last view is going out.
     bool canDestroy();
     bool isMarkedToDestroy() const { return _markToDestroy; }
-    bool isModified() const { return _isModified; }
-    void setModified(const bool value);
 
 private:
     const Poco::URI _uriPublic;
     const std::string _docKey;
     const std::string _childRoot;
     const std::string _cacheRoot;
+    std::shared_ptr<ChildProcess> _childProcess;
     Poco::URI _uriJailed;
     std::string _jailId;
     std::string _filename;
@@ -192,7 +193,6 @@ private:
     std::map<std::string, std::shared_ptr<MasterProcessSession>> _sessions;
     std::unique_ptr<StorageBase> _storage;
     std::unique_ptr<TileCache> _tileCache;
-    std::shared_ptr<ChildProcess> _childProcess;
     bool _markToDestroy;
     bool _isModified;
     mutable std::mutex _mutex;
diff --git a/loolwsd/LOKitHelper.hpp b/loolwsd/LOKitHelper.hpp
index e5dde73..84b0e61 100644
--- a/loolwsd/LOKitHelper.hpp
+++ b/loolwsd/LOKitHelper.hpp
@@ -37,7 +37,7 @@ namespace LOKitHelper
     }
 
     inline
-    std::string kitCallbackTypeToString (const int nType)
+    std::string kitCallbackTypeToString(const int nType)
     {
         // Keep in the same order as in LibreOfficeKitEnums.h
         switch (nType)
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 56dcdb6..a0e46ef 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -201,8 +201,7 @@ static std::shared_ptr<ChildProcess> getNewChild()
         balance -= available - 1;
     }
 
-    if (balance > 0)
-        forkChildren(balance);
+    forkChildren(balance);
 
     const auto timeout = std::chrono::milliseconds(CHILD_TIMEOUT_SECS * 1000);
     if (newChildrenCV.wait_for(lock, timeout, [](){ return !newChildren.empty(); }))
@@ -280,6 +279,7 @@ private:
 
                 if (!isFound)
                 {
+                    //FIXME: outdated!
                     Log::info() << "Retrying client permission... " << retries << Log::end;
                     // request again new URL session
                     const std::string message = "request " + clientSession->getId() + " " + docBroker->getDocKey() + '\n';
@@ -468,6 +468,10 @@ private:
     {
         Log::info("Starting GET request handler for session [" + id + "].");
 
+        // indicator to the client that document broker is searching
+        std::string status("statusindicator: find");
+        ws->sendFrame(status.data(), (int) status.size());
+
         // Remove the leading '/' in the GET URL.
         std::string uri = request.getURI();
         if (uri.size() > 0 && uri[0] == '/')
@@ -475,10 +479,6 @@ private:
             uri.erase(0, 1);
         }
 
-        // indicator to the client that document broker is searching
-        std::string status("statusindicator: find");
-        ws->sendFrame(status.data(), (int) status.size());
-
         const auto uriPublic = DocumentBroker::sanitizeURI(uri);
         const auto docKey = DocumentBroker::getDocKey(uriPublic);
         std::shared_ptr<DocumentBroker> docBroker;
@@ -726,6 +726,7 @@ public:
                 }
                 catch (const WebSocketErrorMessageException& exc)
                 {
+                    // Internal error that should be passed on to the client.
                     Log::error(std::string("ClientRequestHandler::handleRequest: WebSocketErrorMessageException: ") + exc.what());
                     try
                     {


More information about the Libreoffice-commits mailing list