[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/DocumentBroker.hpp loolwsd/LOOLWSD.cpp
Jan Holesovsky
kendy at collabora.com
Mon May 2 09:50:59 UTC 2016
loolwsd/DocumentBroker.cpp | 30 ------------------------------
loolwsd/DocumentBroker.hpp | 20 +-------------------
loolwsd/LOOLWSD.cpp | 1 -
3 files changed, 1 insertion(+), 50 deletions(-)
New commits:
commit 20ab6e8ae70254557e5bff242dbb9d5861fa946c
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon May 2 11:49:03 2016 +0200
Revert "loolwsd: establish communication with child from DocumentBroker"
Unfortunately this causes a deadlock in the unit tests.
This reverts commit 10417c9447ec1d34a8a599daf28ac4339a37930a.
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 52e30f0..8f50e32 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -17,27 +17,6 @@
#include "LOOLWSD.hpp"
#include "Storage.hpp"
#include "TileCache.hpp"
-#include "LOOLProtocol.hpp"
-
-using namespace LOOLProtocol;
-
-void ChildProcess::socketProcessor()
-{
- IoUtil::SocketProcessor(_ws,
- [this](const std::vector<char>& payload)
- {
- auto docBroker = this->_docBroker.lock();
- if (docBroker)
- {
- return docBroker->handleInput(payload);
- }
-
- Log::warn("No DocumentBroker to handle child message: [" + LOOLProtocol::getAbbreviatedMessage(payload) + "].");
- return true;
- },
- []() { },
- [this]() { return !!this->_stop; });
-}
namespace
{
@@ -100,7 +79,6 @@ DocumentBroker::DocumentBroker(const Poco::URI& uriPublic,
{
assert(!_docKey.empty());
assert(!_childRoot.empty());
-
Log::info("DocumentBroker [" + _uriPublic.toString() + "] created. DocKey: [" + _docKey + "]");
}
@@ -381,14 +359,6 @@ size_t DocumentBroker::removeSession(const std::string& id)
return _sessions.size();
}
-bool DocumentBroker::handleInput(const std::vector<char>& payload)
-{
- Log::trace("DocumentBroker got child message: [" + LOOLProtocol::getAbbreviatedMessage(payload) + "].");
-
- //TODO: Handle message.
- return true;
-}
-
bool DocumentBroker::canDestroy()
{
std::unique_lock<std::mutex> lock(_mutex);
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index efdedc3..965ced3 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -17,7 +17,6 @@
#include <memory>
#include <mutex>
#include <string>
-#include <thread>
#include <map>
#include <Poco/URI.h>
@@ -40,10 +39,8 @@ public:
/// @param ws is the control WebSocket to the child.
ChildProcess(const Poco::Process::PID pid, const std::shared_ptr<Poco::Net::WebSocket>& ws) :
_pid(pid),
- _ws(ws),
- _stop(false)
+ _ws(ws)
{
- _thread = std::thread([this]() { this->socketProcessor(); });
Log::info("ChildProcess ctor [" + std::to_string(_pid) + "].");
}
@@ -60,15 +57,8 @@ public:
}
}
- void setDocumentBroker(const std::shared_ptr<DocumentBroker>& docBroker)
- {
- _docBroker = docBroker;
- }
-
void close(const bool rude)
{
- _stop = true;
- _thread.join();
_ws.reset();
if (_pid != -1)
{
@@ -105,14 +95,8 @@ public:
}
private:
- void socketProcessor();
-
-private:
Poco::Process::PID _pid;
std::shared_ptr<Poco::Net::WebSocket> _ws;
- std::weak_ptr<DocumentBroker> _docBroker;
- std::thread _thread;
- std::atomic<bool> _stop;
};
/// DocumentBroker is responsible for setting up a document
@@ -200,8 +184,6 @@ public:
bool canDestroy();
bool isMarkedToDestroy() const { return _markToDestroy; }
- bool handleInput(const std::vector<char>& payload);
-
private:
/// Sends the .uno:Save command to LoKit.
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 1266417..5de9afc 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -533,7 +533,6 @@ private:
// Set one we just created.
Log::debug("New DocumentBroker for docKey [" + docKey + "].");
docBroker = std::make_shared<DocumentBroker>(uriPublic, docKey, LOOLWSD::ChildRoot, child);
- child->setDocumentBroker(docBroker);
}
// Validate the broker.
More information about the Libreoffice-commits
mailing list