[Libreoffice-commits] online.git: 2 commits - loolwsd/LOOLSession.hpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/TileCache.cpp

Tor Lillqvist tml at collabora.com
Fri Jun 5 06:20:06 PDT 2015


 loolwsd/LOOLSession.hpp |    2 +-
 loolwsd/LOOLWSD.cpp     |   12 ++++++++++--
 loolwsd/LOOLWSD.hpp     |    1 +
 loolwsd/TileCache.cpp   |    3 ++-
 4 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 316bfe487d5f5e26d64f0856a42afe37e0aabc4d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Jun 5 13:05:51 2015 +0300

    Correct documentation for _docURL

diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp
index c73456c..7cac320 100644
--- a/loolwsd/LOOLSession.hpp
+++ b/loolwsd/LOOLSession.hpp
@@ -67,7 +67,7 @@ protected:
     // jailed process, the websocket to the parent.
     std::shared_ptr<Poco::Net::WebSocket> _ws;
 
-    // In the master, the actual URL. In the child, the copy inside the chroot jail.
+    // The actual URL, also in the child, even if the child never accesses that.
     std::string _docURL;
 };
 
commit ea2141ffe78a043d0eaf87133c78fbe401fb5a00
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jun 4 17:07:49 2015 +0300

    Take the tile cache directory as an option, too

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index b2668cb..18c21b3 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -396,6 +396,7 @@ public:
 };
 
 int LOOLWSD::portNumber = DEFAULT_CLIENT_PORT_NUMBER;
+std::string LOOLWSD::cache = LOOLWSD_CACHEDIR;
 std::string LOOLWSD::sysTemplate;
 std::string LOOLWSD::loTemplate;
 std::string LOOLWSD::childRoot;
@@ -442,6 +443,11 @@ void LOOLWSD::defineOptions(OptionSet& options)
                       .repeatable(false)
                       .argument("port number"));
 
+    options.addOption(Option("cache", "", "Path to a directory where to keep the persistent tile cache (default: " + std::string(LOOLWSD_CACHEDIR) + ").")
+                      .required(false)
+                      .repeatable(false)
+                      .argument("directory"));
+
     options.addOption(Option("systemplate", "", "Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes.")
                       .required(false)
                       .repeatable(false)
@@ -500,6 +506,8 @@ void LOOLWSD::handleOption(const std::string& name, const std::string& value)
     }
     else if (name == "port")
         portNumber = std::stoi(value);
+    else if (name == "cache")
+        cache = value;
     else if (name == "systemplate")
         sysTemplate = value;
     else if (name == "lotemplate")
@@ -720,9 +728,9 @@ int LOOLWSD::main(const std::vector<std::string>& args)
     dropCapability();
 #endif
 
-    if (access(LOOLWSD_CACHEDIR, R_OK | W_OK | X_OK) != 0)
+    if (access(cache.c_str(), R_OK | W_OK | X_OK) != 0)
     {
-        std::cout << "Unable to access " << LOOLWSD_CACHEDIR <<
+        std::cout << "Unable to access " << cache <<
             ", please make sure it exists, and has write permission for this user." << std::endl;
         return Application::EXIT_UNAVAILABLE;
     }
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 2e4b3ef..56a8939 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -26,6 +26,7 @@ public:
     // An Application is a singleton anyway, so just keep these as
     // statics
     static int portNumber;
+    static std::string cache;
     static std::string sysTemplate;
     static std::string loTemplate;
     static std::string childRoot;
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp
index 6622841..a500646 100644
--- a/loolwsd/TileCache.cpp
+++ b/loolwsd/TileCache.cpp
@@ -27,6 +27,7 @@
 #include <Poco/Timestamp.h>
 #include <Poco/URI.h>
 
+#include "LOOLWSD.hpp"
 #include "TileCache.hpp"
 
 using Poco::DigestEngine;
@@ -190,7 +191,7 @@ std::string TileCache::cacheDirName()
 
     digestEngine.update(_docURL.c_str(), _docURL.size());
 
-    return (LOOLWSD_CACHEDIR "/" +
+    return (LOOLWSD::cache + "/" +
             DigestEngine::digestToHex(digestEngine.digest()).insert(3, "/").insert(2, "/").insert(1, "/"));
 }
 


More information about the Libreoffice-commits mailing list