[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp
Henry Castro
hcastro at collabora.com
Thu Aug 6 07:23:43 PDT 2015
loolwsd/LOOLKit.cpp | 2 +-
loolwsd/LOOLWSD.cpp | 18 +++++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)
New commits:
commit 423a200a0e71159a7669b40675a1ab4059db7996
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Aug 6 10:23:27 2015 -0400
loolwsd: change thread names
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 09d0525..4aad389 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -50,7 +50,7 @@ public:
void run() override
{
#ifdef __linux
- if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("prisioner_handler"), 0, 0, 0) != 0)
+ if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("prision_handler"), 0, 0, 0) != 0)
std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
#endif
while (true)
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 31b2cab..30dd22d 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -263,6 +263,17 @@ public:
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) override
{
+#ifdef __linux
+ std::string thread_name;
+ if (request.serverAddress().port() == LOOLWSD::MASTER_PORT_NUMBER)
+ thread_name = "prision_socket";
+ else
+ thread_name = "client_socket";
+
+ if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.c_str()), 0, 0, 0) != 0)
+ std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
+#endif
+
if(!(request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0))
{
response.setStatusAndReason(HTTPResponse::HTTP_BAD_REQUEST);
@@ -288,13 +299,6 @@ public:
else
kind = LOOLSession::Kind::ToClient;
-#ifdef __linux
- std::stringstream thread_name;
- thread_name << kind;
- if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.str().c_str()), 0, 0, 0) != 0)
- std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
-#endif
-
std::shared_ptr<MasterProcessSession> session(new MasterProcessSession(ws, kind));
// For ToClient sessions, we store incoming messages in a queue and have a separate
More information about the Libreoffice-commits
mailing list