[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/LOOLWSD.hpp loolwsd/PrisonerSession.cpp loolwsd/TraceFile.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 8 03:48:13 UTC 2016
loolwsd/DocumentBroker.cpp | 2 ++
loolwsd/LOOLWSD.hpp | 9 +++++++++
loolwsd/PrisonerSession.cpp | 2 ++
loolwsd/TraceFile.hpp | 11 +++++++++++
4 files changed, 24 insertions(+)
New commits:
commit 177802154da969a5d48469e934226830cfdf755e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jul 31 07:54:47 2016 -0400
loolwsd: trace notifications and response messages
Change-Id: I45f69386762d69e2b3960eeb96e591d7c5843b0b
Reviewed-on: https://gerrit.libreoffice.org/27955
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 7b4640b..f998ab4 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -454,6 +454,8 @@ bool DocumentBroker::handleInput(const std::vector<char>& payload)
Log::trace("DocumentBroker got child message: [" + LOOLProtocol::getAbbreviatedMessage(payload) + "].");
const auto command = LOOLProtocol::getFirstToken(payload);
+ LOOLWSD::dumpOutgoingTrace(command);
+
if (command == "tile:")
{
handleTileResponse(payload);
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 0b9f6bc..72f3ffe 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -70,6 +70,15 @@ public:
}
}
+ static
+ void dumpOutgoingTrace(const std::string& data)
+ {
+ if (TraceDumper)
+ {
+ TraceDumper->writeOutgoing(data);
+ }
+ }
+
protected:
void initialize(Poco::Util::Application& self) override;
void uninitialize() override;
diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index 5da9780..2114f5c 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -54,6 +54,8 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
Log::trace(getName() + ": handling [" + firstLine + "].");
+ LOOLWSD::dumpOutgoingTrace(firstLine);
+
if (LOOLProtocol::tokenIndicatesUserInteraction(tokens[0]))
{
// Keep track of timestamps of incoming client messages that indicate user activity.
diff --git a/loolwsd/TraceFile.hpp b/loolwsd/TraceFile.hpp
index 9b2d3b9..476b409 100644
--- a/loolwsd/TraceFile.hpp
+++ b/loolwsd/TraceFile.hpp
@@ -36,6 +36,17 @@ public:
_stream.write("\n", 1);
}
+ void writeOutgoing(const std::string& data)
+ {
+ std::unique_lock<std::mutex> lock(_mutex);
+ const Poco::Int64 usec = Poco::Timestamp().epochMicroseconds() - _epochStart;
+ _stream.write("<", 1);
+ _stream << usec;
+ _stream.write("<", 1);
+ _stream.write(data.c_str(), data.size());
+ _stream.write("\n", 1);
+ }
+
private:
const Poco::Int64 _epochStart;
std::fstream _stream;
More information about the Libreoffice-commits
mailing list