wsd: initialization and logging
Change-Id: Icd82a966b94875a65ddb3817c88a3c4c7bedd4ff Reviewed-on: https://gerrit.libreoffice.org/36030 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
e0822f8516
commit
d6577654bd
3 changed files with 13 additions and 11 deletions
|
@ -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()
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue