loolwsd/LOOLKit.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
New commits: commit 2c7b4490ec7f877f891096a6ad108e5b87364adf Author: Henry Castro <hcas...@collabora.com> Date: Thu Jan 7 23:23:41 2016 -0400 loolwsd: ensure to remove the connection of unloaded document diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index ba7ab62..8ac56d3 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -560,6 +560,24 @@ public: } } + void purgeSessions() + { + for (auto it =_connections.cbegin(); it != _connections.cend(); ) + { + if (!it->second->isRunning()) + { + _connections.erase(it++); + continue; + } + it++; + } + } + + bool hasConnections() + { + return _connections.size() > 0; + } + private: void onLoad(LibreOfficeKitDocument *loKitDocument, const int viewId) @@ -703,6 +721,18 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s if (tokens[0] == "search") { + // remove document that is unloaded + for (auto it =_documents.cbegin(); it != _documents.cend(); ) + { + it->second->purgeSessions(); + if (!it->second->hasConnections()) + { + _documents.erase(it++); + continue; + } + it++; + } + if (_documents.empty()) { aResponse += "empty \r\n"; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits