[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp
wsd/DocumentBroker.hpp |3 --- wsd/LOOLWSD.cpp|3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) New commits: commit 5bd124499ce03d2c0b30165c99468f7a00646648 Author: Pranav Kant Date: Fri Feb 2 00:36:53 2018 +0530 wsd: Bin superfluous public method Passing the reason to stop() method also does the same thing. Change-Id: I16b648495382c14f31839acca815835df76d8dca diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 1571e426..a398e701 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -349,9 +349,6 @@ public: /// Sends a message to all sessions void broadcastMessage(const std::string& message); -/// Sets the reason for closing document; -void setCloseReason(const std::string& closeReason) { _closeReason = closeReason; } - private: /// Shutdown all client connections with the given reason. diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index eecb793f..34482638 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -1555,8 +1555,7 @@ private: { auto lock = docBroker->getLock(); docBroker->assertCorrectThread(); -docBroker->setCloseReason("docdisconnected"); -docBroker->stop("Lost connection with LOKit."); +docBroker->stop("docisdisconnected"); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp
wsd/DocumentBroker.hpp |6 ++ wsd/LOOLWSD.cpp|6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) New commits: commit 8901fcf074da289bfc7063eff0e21175f439ae3a Author: Ashod Nakashian Date: Sun Mar 12 19:18:12 2017 -0400 wsd: ChildProcess doesn't need friends Change-Id: I1911920c9b49adecac4ea4d8fc4b0830687b80c7 Reviewed-on: https://gerrit.libreoffice.org/35121 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 9836872..8d7eb2a 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -60,8 +60,6 @@ public: /// to host a document. class ChildProcess { -// FIXME: urk ... -friend class PrisonerRequestDispatcher; public: /// @param pid is the process ID of the child. /// @param socket is the underlying Sockeet to the child. @@ -92,11 +90,11 @@ public: } void setDocumentBroker(const std::shared_ptr& docBroker); +std::shared_ptr getDocumentBroker() const { return _docBroker.lock(); } void stop() { -// FIXME: stop !? -LOG_ERR("What do we do for stop?"); +// Request the child to exit. try { if (isAlive()) diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index b8a2b9d..310d576 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -1454,7 +1454,7 @@ public: { // Notify the broker that we're done. auto child = _childProcess.lock(); -auto docBroker = child ? child->_docBroker.lock() : nullptr; +auto docBroker = child ? child->getDocumentBroker() : nullptr; if (docBroker) { // FIXME: No need to notify if asked to stop. @@ -1587,7 +1587,7 @@ private: LOG_TRC("Prisoner message [" << getAbbreviatedMessage(&data[0], data.size()) << "]."); auto child = _childProcess.lock(); -auto docBroker = child ? child->_docBroker.lock() : nullptr; +auto docBroker = child ? child->getDocumentBroker() : nullptr; if (docBroker) { // We should never destroy the broker, since @@ -1598,7 +1598,7 @@ private: return; } -LOG_WRN("Child " << child->_pid << +LOG_WRN("Child " << child->getPid() << " has no DocumentBroker to handle message: [" << LOOLProtocol::getAbbreviatedMessage(data) << "]."); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp
wsd/DocumentBroker.hpp |1 + wsd/LOOLWSD.cpp|8 +++- 2 files changed, 8 insertions(+), 1 deletion(-) New commits: commit 7f19d809b16d17f669f6e15b3bf52db1c764a975 Author: Ashod Nakashian Date: Fri Feb 10 01:43:32 2017 -0500 wsd: skip busy docBrokers when cleaning up When cleaning up DocumentBrokers we hold the global DocBrokersMutex. So we need to keep this lock as short as possible to serve new requests. However when a given DocBroker is locked and busy, or worse deadlocked, we'd end up blocking any new client connection. So here we skip busy DocBrokers while cleaning up. Change-Id: I188c9abc34fd90c4ba388894b47c1ab08d185129 Reviewed-on: https://gerrit.libreoffice.org/34119 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index a401b5a..2c0122d 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -312,6 +312,7 @@ public: Poco::Process::PID getPid() const { return _childProcess->getPid(); } std::unique_lock getLock() { return std::unique_lock(_mutex); } +std::unique_lock getDeferredLock() { return std::unique_lock(_mutex, std::defer_lock); } void updateLastActivityTime(); diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 399a175..05cd665 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -281,7 +281,13 @@ bool cleanupDocBrokers() for (auto it = DocBrokers.begin(); it != DocBrokers.end(); ) { auto docBroker = it->second; -auto lock = docBroker->getLock(); +auto lock = docBroker->getDeferredLock(); +if (!lock.try_lock()) +{ +// Document busy at the moment, cleanup later. +++it; +continue; +} // Remove idle documents after 1 hour. const bool idle = (docBroker->getIdleTimeSecs() >= 3600); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits