net/Socket.cpp | 5 ++++- net/Socket.hpp | 15 ++++++++------- wsd/LOOLWSD.cpp | 4 +--- 3 files changed, 13 insertions(+), 11 deletions(-)
New commits: commit d6577654bdc45892d9546ecfccdccd549b01921a Author: Ashod Nakashian <[email protected]> Date: Sun Apr 2 17:49:14 2017 -0400 wsd: initialization and logging Change-Id: Icd82a966b94875a65ddb3817c88a3c4c7bedd4ff Reviewed-on: https://gerrit.libreoffice.org/36030 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/net/Socket.cpp b/net/Socket.cpp index 2b9899f8..3a07470c 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -43,7 +43,8 @@ SocketPoll::SocketPoll(const std::string& threadName) : _name(threadName), _stop(false), _threadStarted(false), - _threadFinished(false) + _threadFinished(false), + _owner(std::this_thread::get_id()) { // Create the wakeup fd. if (::pipe2(_wakeup, O_CLOEXEC | O_NONBLOCK) == -1) @@ -56,9 +57,11 @@ SocketPoll::SocketPoll(const std::string& threadName) getWakeupsArray().push_back(_wakeup[1]); } +#if ENABLE_DEBUG _owner = std::this_thread::get_id(); LOG_DBG("Thread affinity of " << _name << " set to 0x" << std::hex << _owner << "." << std::dec); +#endif } SocketPoll::~SocketPoll() diff --git a/net/Socket.hpp b/net/Socket.hpp index 94d4cc34..9977f481 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -47,15 +47,14 @@ public: Socket() : _fd(socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0)), - _sendBufferSize(DefaultSendBufferSize) + _sendBufferSize(DefaultSendBufferSize), + _owner(std::this_thread::get_id()) { init(); } virtual ~Socket() { - // TODO: Should we shutdown here or up to the client? - LOG_TRC("#" << getFD() << " Socket dtor."); // Doesn't block on sockets; no error handling needed. @@ -231,11 +230,13 @@ protected: _sendBufferSize = DefaultSendBufferSize; #if ENABLE_DEBUG _owner = std::this_thread::get_id(); - LOG_DBG("#" << _fd << " Thread affinity set to 0x" << std::hex << _owner << "." << std::dec); + LOG_DBG("#" << _fd << " Thread affinity set to 0x" << std::hex << + _owner << "." << std::dec); const int oldSize = getSocketBufferSize(); setSocketBufferSize(0); - LOG_TRC("#" << _fd << ": Buffer size: " << getSendBufferSize() << " (was " << oldSize << ")"); + LOG_TRC("#" << _fd << ": Buffer size: " << getSendBufferSize() << + " (was " << oldSize << ")"); #endif } @@ -323,8 +324,8 @@ public: rc = ::poll(&_pollFds[0], size + 1, std::max(timeoutMaxMs,0)); } while (rc < 0 && errno == EINTR); - LOG_TRC("Poll completed with " << rc << " live polls max (" << timeoutMaxMs << "ms)" - << ((rc==0) ? "(timedout)" : "")); + LOG_TRC("Poll completed with " << rc << " live polls max (" << + timeoutMaxMs << "ms)" << ((rc==0) ? "(timedout)" : "")); // Fire the callback and remove dead fds. std::chrono::steady_clock::time_point newNow = diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 05c6e1da..2cc7bf51 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -1322,9 +1322,7 @@ static std::shared_ptr<ClientSession> createNewClientSession(const WebSocketHand // In case of WOPI, if this session is not set as readonly, it might be set so // later after making a call to WOPI host which tells us the permission on files // (UserCanWrite param). - auto session = std::make_shared<ClientSession>(id, docBroker, uriPublic, isReadOnly); - - return session; + return std::make_shared<ClientSession>(id, docBroker, uriPublic, isReadOnly); } catch (const std::exception& exc) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
