[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/IoUtil.cpp loolwsd/IoUtil.hpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Apr 4 04:07:00 UTC 2016
loolwsd/Common.hpp | 1 +
loolwsd/IoUtil.cpp | 3 +--
loolwsd/IoUtil.hpp | 2 +-
loolwsd/LOOLKit.cpp | 3 ++-
loolwsd/LOOLWSD.cpp | 7 ++++++-
5 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 4be24759f37ce67c15f1b443d72cc26c5798bc83
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Apr 3 10:31:46 2016 -0400
loolwsd: SocketProcessor takes HTTPResponse and not HTTPServerResponse
Change-Id: I8a6e1468bc26b4a81ae13a567fd7331207ac37fc
Reviewed-on: https://gerrit.libreoffice.org/23786
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index 40613e3..f14f5b6 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -33,6 +33,7 @@ constexpr int READ_BUFFER_SIZE = 2048;
/// size are considered small messages.
constexpr int SMALL_MESSAGE_SIZE = READ_BUFFER_SIZE / 2;
+constexpr auto NEW_CHILD_URI = "/loolws/newchild?";
constexpr auto CHILD_URI = "/loolws/child?";
constexpr auto FIFO_LOOLWSD = "loolwsdfifo";
constexpr auto FIFO_PATH = "pipe";
diff --git a/loolwsd/IoUtil.cpp b/loolwsd/IoUtil.cpp
index a01baba..7dae0d4 100644
--- a/loolwsd/IoUtil.cpp
+++ b/loolwsd/IoUtil.cpp
@@ -37,7 +37,7 @@ using Poco::Net::WebSocketException;
// Synchronously process WebSocket requests and dispatch to handler.
// Handler returns false to end.
void SocketProcessor(std::shared_ptr<WebSocket> ws,
- Poco::Net::HTTPServerResponse& response,
+ Poco::Net::HTTPResponse& response,
std::function<bool(const std::vector<char>&)> handler,
std::function<bool()> stopPredicate,
std::string name,
@@ -184,7 +184,6 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
case WebSocket::WS_ERR_HANDSHAKE_NO_KEY:
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_BAD_REQUEST);
response.setContentLength(0);
- response.send();
break;
}
}
diff --git a/loolwsd/IoUtil.hpp b/loolwsd/IoUtil.hpp
index aa67f21..17dfcc8 100644
--- a/loolwsd/IoUtil.hpp
+++ b/loolwsd/IoUtil.hpp
@@ -24,7 +24,7 @@ namespace IoUtil
/// Synchronously process WebSocket requests and dispatch to handler.
//. Handler returns false to end.
void SocketProcessor(std::shared_ptr<Poco::Net::WebSocket> ws,
- Poco::Net::HTTPServerResponse& response,
+ Poco::Net::HTTPResponse& response,
std::function<bool(const std::vector<char>&)> handler,
std::function<bool()> stopPredicate,
std::string name = std::string(),
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 9c56fb7..cdf2ca0 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -865,7 +865,8 @@ void lokit_main(const std::string& childRoot,
// Ideally this will be a random ID, but broker will cleanup
// our jail directory when we die, and it's simpler to know
// the jailId (i.e. the path) implicitly by knowing our pid.
- static const std::string jailId = std::to_string(Process::id());
+ static const std::string pid = std::to_string(Process::id());
+ static const std::string jailId = pid;
static const std::string process_name = "loolkit";
if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(process_name.c_str()), 0, 0, 0) != 0)
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index a2c3466..6a382e1 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -590,6 +590,12 @@ public:
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) override
{
+ std::string thread_name = "prison_ws_";
+ if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.c_str()), 0, 0, 0) != 0)
+ Log::error("Cannot set thread name to " + thread_name + ".");
+
+ Log::debug("Child connection with URI [" + request.getURI() + "].");
+
assert(request.serverAddress().port() == MASTER_PORT_NUMBER);
if (request.getURI().find(CHILD_URI) != 0)
{
@@ -597,7 +603,6 @@ public:
return;
}
- std::string thread_name = "prison_ws_";
try
{
const auto params = Poco::URI(request.getURI()).getQueryParameters();
More information about the Libreoffice-commits
mailing list