loolwsd: Poco HTTPRequest and co are not thread-safe

Change-Id: I5b7a290651a51f117da1dd972f4c24bdebd2b3b2
Reviewed-on: https://gerrit.libreoffice.org/28300
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-08-21 08:21:59 -04:00 committed by Ashod Nakashian
parent e65535b7cb
commit c98af7c5a0

View file

@ -85,6 +85,8 @@ public:
{
Poco::URI uri(serverURI);
std::unique_lock<std::mutex> lock(Mutex);
// Load a document and get its status.
std::cerr << "NewSession [" << sessionId << "]: " << uri.toString() << "... ";
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/lool/ws/" + documentURL);
@ -111,8 +113,11 @@ private:
const std::string _documentURL;
const std::string _sessionId;
std::shared_ptr<Poco::Net::WebSocket> _ws;
static std::mutex Mutex;
};
std::mutex Connection::Mutex;
/// Main thread class to replay a trace file.
class Worker: public Runnable
{