[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp loolwsd/test loolwsd/Unit.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Apr 17 15:26:28 UTC 2016
loolwsd/Common.hpp | 2 +-
loolwsd/LOOLKit.cpp | 3 ++-
loolwsd/LOOLWSD.cpp | 2 ++
loolwsd/Unit.hpp | 3 +++
loolwsd/test/UnitPrefork.cpp | 10 +++++-----
5 files changed, 13 insertions(+), 7 deletions(-)
New commits:
commit a70c5300b12a13821cbe1cd4fc77add8bafe869c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Apr 17 09:54:05 2016 -0400
loolwsd: childConnected event added to UnitWSD
Change-Id: I3d19465229b434d07f50290f08462e9c9c66a6ca
Reviewed-on: https://gerrit.libreoffice.org/24160
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 d287736..985c26c 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -31,10 +31,10 @@ constexpr int READ_BUFFER_SIZE = 2048;
/// size are considered small messages.
constexpr int SMALL_MESSAGE_SIZE = READ_BUFFER_SIZE / 2;
-constexpr auto CHILD_URI = "/loolws/child?";
constexpr auto FIFO_LOOLWSD = "loolwsdfifo";
constexpr auto FIFO_PATH = "pipe";
constexpr auto JAILED_DOCUMENT_ROOT = "/user/docs/";
+constexpr auto CHILD_URI = "/loolws/child?";
constexpr auto NEW_CHILD_URI = "/loolws/newchild?";
// The client port number, both loolwsd and the kits have this.
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 1a91bb6..4a2f94d 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -442,7 +442,8 @@ public:
// parent. The parent forwards us requests that it can't handle (i.e most).
HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER);
cs.setTimeout(0);
- HTTPRequest request(HTTPRequest::HTTP_GET, std::string(CHILD_URI) + "sessionId=" + sessionId + "&jailId=" + _jailId + "&docKey=" + _docKey);
+ const auto childUrl = std::string(CHILD_URI) + "sessionId=" + sessionId + "&jailId=" + _jailId + "&docKey=" + _docKey;
+ HTTPRequest request(HTTPRequest::HTTP_GET, childUrl);
HTTPResponse response;
auto ws = std::make_shared<WebSocket>(cs, request, response);
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 30c52e9..c608925 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -892,6 +892,8 @@ public:
// Now the bridge beetween the prison and the client is connected
// Let messages flow
+ UnitWSD::get().onChildConnected(pid, sessionId);
+
IoUtil::SocketProcessor(ws,
[&session](const std::vector<char>& payload)
{
diff --git a/loolwsd/Unit.hpp b/loolwsd/Unit.hpp
index 4ae4634..c9a7a6d 100644
--- a/loolwsd/Unit.hpp
+++ b/loolwsd/Unit.hpp
@@ -130,6 +130,9 @@ public:
Poco::Net::HTTPServerRequest& /* request */,
Poco::Net::HTTPServerResponse& /* response */)
{ return false; }
+
+ // ---------------- WSD events ----------------
+ virtual void onChildConnected(const int /* pid */, const std::string& /* sessionId */) {}
};
/// Derive your Kit unit test / hooks from me.
diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp
index aad9a69..0246f3f 100644
--- a/loolwsd/test/UnitPrefork.cpp
+++ b/loolwsd/test/UnitPrefork.cpp
@@ -150,19 +150,19 @@ public:
virtual void postFork() override
{
// before we drop the caps we can even open our /proc files !
- std::string procName = std::string("/proc/") +
- std::to_string(getpid()) +
- std::string("/smaps");
+ const std::string procName = std::string("/proc/") +
+ std::to_string(getpid()) +
+ std::string("/smaps");
_procSMaps = fopen(procName.c_str(), "r");
}
virtual bool filterKitMessage(const std::shared_ptr<Poco::Net::WebSocket> &ws,
std::string &message) override
{
- std::string token = LOOLProtocol::getFirstToken(message.c_str(), message.length());
+ const auto token = LOOLProtocol::getFirstToken(message.c_str(), message.length());
if (token == "unit-memdump:")
{
- std::string memory = readMemorySizes(_procSMaps) + "\n";
+ const std::string memory = readMemorySizes(_procSMaps) + "\n";
ws->sendFrame(memory.c_str(), memory.length());
return true;
}
More information about the Libreoffice-commits
mailing list