[Libreoffice-commits] online.git: 2 commits - common/Unit.hpp test/UnitClient.cpp wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/Storage.cpp

Michael Meeks michael.meeks at collabora.com
Fri Jun 16 19:25:46 UTC 2017


 common/Unit.hpp        |    6 ++++++
 test/UnitClient.cpp    |    6 ++++++
 wsd/DocumentBroker.cpp |    3 +++
 wsd/LOOLWSD.cpp        |    3 +++
 wsd/Storage.cpp        |    4 ++--
 5 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 7b90179fe832194233ba08bff655243054a7cce6
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jun 16 18:34:07 2017 +0100

    Check for spare space in the right place.
    
    ie. destination not source of the local file.
    
    Change-Id: I4d4c4e56deb039a44d8c2ab2886b8ca52bdb2ef8

diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index bc205446..6f185085 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -242,9 +242,9 @@ std::string LocalStorage::loadStorageFileToLocal(const std::string& /*accessToke
     // Despite the talk about URIs it seems that _uri is actually just a pathname here
     const auto publicFilePath = _uri.getPath();
 
-    if (!FileUtil::checkDiskSpace(publicFilePath))
+    if (!FileUtil::checkDiskSpace(_jailedFilePath))
     {
-        throw StorageSpaceLowException("Low disk space for " + publicFilePath);
+        throw StorageSpaceLowException("Low disk space for " + _jailedFilePath);
     }
 
     LOG_INF("Linking " << publicFilePath << " to " << _jailedFilePath);
commit 7ea5f71a7bd29ab855c7b19a01e19ed9b3fd2fbf
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jun 16 17:55:23 2017 +0100

    Units: allow filtering of user alerts.
    
    Catch things that kill tests like disk-full earlier.
    
    Change-Id: Ib50b516063305f2fc93b662ec3ad9ab6c52c6c92

diff --git a/common/Unit.hpp b/common/Unit.hpp
index 5f8d20ea..1b0822bb 100644
--- a/common/Unit.hpp
+++ b/common/Unit.hpp
@@ -102,6 +102,12 @@ public:
         return false;
     }
 
+    /// Trap and filter alerting all users
+    virtual bool filterAlertAllusers(const std::string & /* msg */)
+    {
+        return false;
+    }
+
     /// If the test times out this gets invoked, the default just exits.
     virtual void timeout();
 
diff --git a/test/UnitClient.cpp b/test/UnitClient.cpp
index 46aaaf34..5d29516c 100644
--- a/test/UnitClient.cpp
+++ b/test/UnitClient.cpp
@@ -35,6 +35,12 @@ public:
         _worker.join();
     }
 
+    virtual bool filterAlertAllusers(const std::string & msg)
+    {
+        std::cout << "Alert: " << msg << "\n";
+        return false;
+    }
+
     void configure(Poco::Util::LayeredConfiguration& config) override
     {
         UnitWSD::configure(config);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index fd04998a..71af4b19 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -983,6 +983,9 @@ void DocumentBroker::alertAllUsers(const std::string& msg)
 {
     assertCorrectThread();
 
+    if (UnitWSD::get().filterAlertAllusers(msg))
+        return;
+
     auto payload = std::make_shared<Message>(msg, Message::Dir::Out);
 
     LOG_DBG("Alerting all users of [" << _docKey << "]: " << msg);
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a981d2e0..989ff496 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -217,6 +217,9 @@ void alertAllUsersInternal(const std::string& msg)
 
     LOG_INF("Alerting all users: [" << msg << "]");
 
+    if (UnitWSD::get().filterAlertAllusers(msg))
+        return;
+
     for (auto& brokerIt : DocBrokers)
     {
         std::shared_ptr<DocumentBroker> docBroker = brokerIt.second;


More information about the Libreoffice-commits mailing list