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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jun 11 20:18:07 UTC 2018


 wsd/LOOLWSD.cpp |   56 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

New commits:
commit 93b41638a58b9e36940bc3faaeb9a0fab7d6524a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Feb 23 19:18:24 2018 -0500

    wsd: reduce indentation
    
    Change-Id: Id8cda0980d332eb751fbb2708b9075296bf15a0b
    Reviewed-on: https://gerrit.libreoffice.org/52417
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 3bc6d73e6..a66d0306d 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2050,37 +2050,36 @@ private:
                 format = tokens[3];
 
             bool sent = false;
-            if (!fromPath.empty())
+            if (!fromPath.empty() && !format.empty())
             {
-                if (!format.empty())
-                {
-                    LOG_INF("Conversion request for URI [" << fromPath << "].");
+                LOG_INF("Conversion request for URI [" << fromPath << "].");
 
-                    Poco::URI uriPublic = DocumentBroker::sanitizeURI(fromPath);
-                    const std::string docKey = DocumentBroker::getDocKey(uriPublic);
+                Poco::URI uriPublic = DocumentBroker::sanitizeURI(fromPath);
+                const std::string docKey = DocumentBroker::getDocKey(uriPublic);
 
-                    // This lock could become a bottleneck.
-                    // In that case, we can use a pool and index by publicPath.
-                    std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
+                // This lock could become a bottleneck.
+                // In that case, we can use a pool and index by publicPath.
+                std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
 
-                    LOG_DBG("New DocumentBroker for docKey [" << docKey << "].");
-                    auto docBroker = std::make_shared<DocumentBroker>(fromPath, uriPublic, docKey, LOOLWSD::ChildRoot);
+                LOG_DBG("New DocumentBroker for docKey [" << docKey << "].");
+                auto docBroker = std::make_shared<DocumentBroker>(fromPath, uriPublic, docKey, LOOLWSD::ChildRoot);
 
-                    cleanupDocBrokers();
+                cleanupDocBrokers();
 
-                    LOG_DBG("New DocumentBroker for docKey [" << docKey << "].");
-                    DocBrokers.emplace(docKey, docBroker);
-                    LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after inserting [" << docKey << "].");
+                LOG_DBG("New DocumentBroker for docKey [" << docKey << "].");
+                DocBrokers.emplace(docKey, docBroker);
+                LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after inserting [" << docKey << "].");
 
-                    // Load the document.
-                    // TODO: Move to DocumentBroker.
-                    const bool isReadOnly = true;
-                    std::shared_ptr<ClientSession> clientSession = createNewClientSession(nullptr, _id, uriPublic, docBroker, isReadOnly);
-                    if (clientSession)
+                // Load the document.
+                // TODO: Move to DocumentBroker.
+                const bool isReadOnly = true;
+                std::shared_ptr<ClientSession> clientSession = createNewClientSession(nullptr, _id, uriPublic, docBroker, isReadOnly);
+                if (clientSession)
+                {
+                    disposition.setMove([docBroker, clientSession, format]
+                                        (const std::shared_ptr<Socket> &moveSocket)
                     {
-                        disposition.setMove([docBroker, clientSession, format]
-                                            (const std::shared_ptr<Socket> &moveSocket)
-                        { // Perform all of this after removing the socket
+                        // Perform all of this after removing the socket
 
                         // Make sure the thread is running before adding callback.
                         docBroker->startThread();
@@ -2118,13 +2117,12 @@ private:
                             std::vector<char> saveasRequest(saveas.begin(), saveas.end());
                             clientSession->handleMessage(true, WSOpCode::Text, saveasRequest);
                         });
-                        });
+                    });
 
-                        sent = true;
-                    }
-                    else
-                        LOG_WRN("Failed to create Client Session with id [" << _id << "] on docKey [" << docKey << "].");
+                    sent = true;
                 }
+                else
+                    LOG_WRN("Failed to create Client Session with id [" << _id << "] on docKey [" << docKey << "].");
             }
 
             if (!sent)
@@ -2729,11 +2727,13 @@ int LOOLWSD::innerMain()
         LOG_FTL("Missing --systemplate option");
         throw MissingOptionException("systemplate");
     }
+
     if (LoTemplate.empty())
     {
         LOG_FTL("Missing --lotemplate option");
         throw MissingOptionException("lotemplate");
     }
+
     if (ChildRoot.empty())
     {
         LOG_FTL("Missing --childroot option");


More information about the Libreoffice-commits mailing list