[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 13:50:07 UTC 2020


 wsd/DocumentBroker.cpp |   14 +++++++++++++-
 wsd/ProxyProtocol.cpp  |    2 +-
 wsd/ProxyProtocol.hpp  |    5 ++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 36a4b5ad05c527fa38baf85e4f8bd65ed8d11e2f
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Jun 3 17:14:03 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jun 4 15:49:46 2020 +0200

    Proxy: dump ProxyProtocolHandler state separately
    
    Somewhat inelegant - nasty extra header & dynamic cast.
    
    Change-Id: Id18b2f7831ece3b971290e799c5df182429aa2a0
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95448
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index d13a5d1a3..55e921295 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -32,6 +32,7 @@
 #include "SenderQueue.hpp"
 #include "Storage.hpp"
 #include "TileCache.hpp"
+#include "ProxyProtocol.hpp"
 #include <common/Log.hpp>
 #include <common/Message.hpp>
 #include <common/Clipboard.hpp>
@@ -216,7 +217,7 @@ void DocumentBroker::setupPriorities()
         int prio = LOOLWSD::getConfigValue<int>("per_document.batch_priority", 5);
         Util::setProcessAndThreadPriorities(_childProcess->getPid(), prio);
     }
-#endif // !MOBILE
+#endif
 }
 
 void DocumentBroker::startThread()
@@ -2420,6 +2421,17 @@ void DocumentBroker::dumpState(std::ostream& os)
         _tileCache->dumpState(os);
 
     _poll->dumpState(os);
+
+#if !MOBILEAPP
+    // Bit nasty - need a cleaner way to dump state.
+    for (auto &it : _sessions)
+    {
+        auto proto = it.second->getProtocol();
+        auto proxy = dynamic_cast<ProxyProtocolHandler *>(proto.get());
+        if (proxy)
+            proxy->dumpProxyState(os);
+    }
+#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index 4b6950a10..8e7b8a631 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -277,7 +277,7 @@ void ProxyProtocolHandler::getIOStats(uint64_t &sent, uint64_t &recv)
     sent = recv = 0;
 }
 
-void ProxyProtocolHandler::dumpState(std::ostream& os)
+void ProxyProtocolHandler::dumpProxyState(std::ostream& os)
 {
     os << "proxy protocol sockets: " << _outSockets.size() << " writeQueue: " << _writeQueue.size() << ":\n";
     os << '\t';
diff --git a/wsd/ProxyProtocol.hpp b/wsd/ProxyProtocol.hpp
index 7a342912b..d20377b30 100644
--- a/wsd/ProxyProtocol.hpp
+++ b/wsd/ProxyProtocol.hpp
@@ -57,7 +57,10 @@ public:
     int sendBinaryMessage(const char *data, const size_t len, bool flush = false) const override;
     void shutdown(bool goingAway = false, const std::string &statusMessage = "") override;
     void getIOStats(uint64_t &sent, uint64_t &recv) override;
-    void dumpState(std::ostream& os) override;
+    // don't duplicate ourselves for every socket
+    void dumpState(std::ostream&) override {}
+    // instead do it centrally.
+    void dumpProxyState(std::ostream& os);
     bool parseEmitIncoming(const std::shared_ptr<StreamSocket> &socket);
 
     void handleRequest(bool isWaiting, const std::shared_ptr<Socket> &socket);


More information about the Libreoffice-commits mailing list