[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/ServerSocket.hpp net/Socket.cpp net/Socket.hpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp
Michael Meeks
michael.meeks at collabora.com
Mon Mar 6 15:46:12 UTC 2017
net/ServerSocket.hpp | 2 ++
net/Socket.cpp | 14 ++++++++++++++
net/Socket.hpp | 8 +-------
wsd/DocumentBroker.cpp | 14 ++++++++++++++
wsd/DocumentBroker.hpp | 2 ++
wsd/LOOLWSD.cpp | 6 +++++-
6 files changed, 38 insertions(+), 8 deletions(-)
New commits:
commit 56960d34bb2f9949275383e2802c772fc0b576d6
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Mar 6 15:45:34 2017 +0000
Improve socket state dumping on USR1.
diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp
index 881a685..6d86daf 100644
--- a/net/ServerSocket.hpp
+++ b/net/ServerSocket.hpp
@@ -84,6 +84,8 @@ public:
return POLLIN;
}
+ void dumpState() override;
+
HandleResult handlePoll(const Poco::Timestamp &/* now */, int events) override
{
if (events & POLLIN)
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 31cbc1d..88502c8 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -8,6 +8,7 @@
*/
#include "Socket.hpp"
+#include "ServerSocket.hpp"
// help with initialization order
namespace {
@@ -54,6 +55,19 @@ void SocketPoll::wakeupWorld()
wakeup(fd);
}
+void ServerSocket::dumpState()
+{
+ std::cerr << "\t" << getFD() << "\t<accept>\n";
+}
+
+void StreamSocket::dumpState()
+{
+ std::cerr << "\t" << getFD() << "\t" << getPollEvents() << "\t"
+ << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"
+ << "\n";
+ // FIXME: hex dump buffer contents if we have them.
+}
+
void SocketPoll::dumpState()
{
std::cerr << " Poll [" << _pollSockets.size() << "] - wakeup r: "
diff --git a/net/Socket.hpp b/net/Socket.hpp
index a601cb1..ba55503 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -559,13 +559,7 @@ protected:
return ::write(getFD(), buf, len);
}
- void dumpState() override
- {
- std::cerr << "\t" << getFD() << "\t" << getPollEvents() << "\t"
- << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"
- << "\n";
- // FIXME: hex dump buffer contents if we have them.
- }
+ void dumpState() override;
/// Get the Write Lock.
std::unique_lock<std::mutex> getWriteLock() { return std::unique_lock<std::mutex>(_writeMutex); }
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 8f72e21..f1715aa 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1195,4 +1195,18 @@ void DocumentBroker::updateLastActivityTime()
Admin::instance().updateLastActivityTime(_docKey);
}
+void DocumentBroker::dumpState()
+{
+ std::unique_lock<std::mutex> lock(_mutex);
+
+ std::cerr << " Broker: " << _filename << "\n";
+ std::cerr << " jail id: " << _jailId << "\n";
+ std::cerr << " public uri: " << _uriPublic.toString() << "\n";
+ std::cerr << " jailed uri: " << _uriJailed.toString() << "\n";
+ std::cerr << " doc key: " << _docKey << "\n";
+ std::cerr << " num sessions: " << getSessionsCount() << "\n";
+
+ _poll.dumpState();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index a2d23a6..6981d4e 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -255,6 +255,8 @@ public:
return _sessions.size();
}
+ void dumpState();
+
std::string getJailRoot() const;
/// Add a new session. Returns the new number of sessions.
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index aa5607a..51d4430 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2382,8 +2382,12 @@ public:
std::cerr << "Server poll:\n";
_acceptPoll.dumpState();
- std::cerr << "Document poll:\n";
+ std::cerr << "Web Server poll:\n";
_webServerPoll.dumpState();
+
+ std::cerr << "Document Broker polls:\n";
+ for (auto &i : DocBrokers)
+ i.second->dumpState();
}
private:
More information about the Libreoffice-commits
mailing list