net/ServerSocket.hpp | 6 +++--- net/Socket.hpp | 25 +++++++++++++++++-------- wsd/Admin.cpp | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-)
New commits: commit d1e183f20d836fce8ebac3d50a79900d8d11746a Author: Miklos Vajna <vmik...@collabora.co.uk> AuthorDate: Mon Oct 29 09:06:08 2018 +0100 Commit: Miklos Vajna <vmik...@collabora.co.uk> CommitDate: Mon Oct 29 09:06:33 2018 +0100 SocketPoll: make members private All these protected members are unused by child classes, except read access to a single member. diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp index 314b56f2d..7799d8c73 100644 --- a/net/ServerSocket.hpp +++ b/net/ServerSocket.hpp @@ -94,12 +94,12 @@ public: inet_ntop(clientInfo.sin6_family, inAddr, addrstr, sizeof(addrstr)); std::shared_ptr<Socket> _socket = _sockFactory->create(rc); - _socket->_clientAddress = addrstr; + _socket->setClientAddress(addrstr); LOG_DBG("Accepted socket has family " << clientInfo.sin6_family << - " address " << _socket->_clientAddress); + " address " << _socket->clientAddress()); #else std::shared_ptr<Socket> _socket = _sockFactory->create(rc); - _socket->_clientAddress = "dummy"; + _socket->setClientAddress("dummy"); #endif return _socket; } diff --git a/net/Socket.hpp b/net/Socket.hpp index 0c58d20aa..3a28bffdd 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -100,7 +100,6 @@ public: static const int DefaultSendBufferSize = 16 * 1024; static const int MaximumSendBufferSize = 128 * 1024; static std::atomic<bool> InhibitThreadChecks; - std::string _clientAddress; enum Type { IPv4, IPv6, All }; @@ -127,6 +126,16 @@ public: /// Create socket of the given type. static int createSocket(Type type); + void setClientAddress(const std::string& clientAddress) + { + _clientAddress = clientAddress; + } + + const std::string& clientAddress() const + { + return _clientAddress; + } + /// Returns the OS native socket fd. int getFD() const { return _fd; } @@ -323,6 +332,7 @@ protected: } private: + std::string _clientAddress; const int _fd; int _sendBufferSize; @@ -701,6 +711,12 @@ public: return false; } +protected: + bool isStop() const + { + return _stop; + } + private: /// Initialize the poll fds array with the right events void setupPollFds(std::chrono::steady_clock::time_point now, @@ -729,7 +745,6 @@ private: /// Used to set the thread name and mark the thread as stopped when done. void pollingThreadEntry(); -private: /// Debug name used for logging. const std::string _name; @@ -744,7 +759,6 @@ private: /// The fds to poll. std::vector<pollfd> _pollFds; -protected: /// Flag the thread to stop. std::atomic<bool> _stop; /// The polling thread. @@ -933,11 +947,6 @@ public: recv = _bytesRecvd; } - const std::string clientAddress() - { - return _clientAddress; - } - std::vector<char>& getInBuffer() { return _inBuffer; diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp index 6025c59a5..c5f303ad0 100644 --- a/wsd/Admin.cpp +++ b/wsd/Admin.cpp @@ -390,7 +390,7 @@ void Admin::pollingThread() lastMem = lastCPU; lastNet = lastCPU; - while (!_stop && !TerminationFlag && !ShutdownRequestFlag) + while (!isStop() && !TerminationFlag && !ShutdownRequestFlag) { const std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits