wsd: better logging when adding/removing sessions

Change-Id: Ie11886390687c744e1a0f60bff4317898c36f9c2
Reviewed-on: https://gerrit.libreoffice.org/32675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2017-01-03 00:12:15 -05:00 committed by Ashod Nakashian
parent 1cf7a6bca1
commit 6b49ef326a
2 changed files with 18 additions and 11 deletions

View file

@ -621,11 +621,6 @@ size_t DocumentBroker::addSession(std::shared_ptr<ClientSession>& session)
_lastEditableSession = false;
_markToDestroy = false;
if (session->isReadOnly())
{
LOG_DBG("Adding a readonly session [" << id << "]");
}
if (!_sessions.emplace(id, session).second)
{
LOG_WRN("DocumentBroker: Trying to add already existing session.");
@ -638,11 +633,15 @@ size_t DocumentBroker::addSession(std::shared_ptr<ClientSession>& session)
// Request a new session from the child kit.
_childProcess->sendTextFrame(aMessage);
// Now we are ready to bridge between the kit and client.
session->bridgePrisonerSession();
// Tell the admin console about this new doc
Admin::instance().addDoc(_docKey, getPid(), getFilename(), id);
// Now we are ready to bridge between the kit and client.
session->bridgePrisonerSession();
LOG_TRC("Added " << (session->isReadOnly() ? "readonly" : "non-readonly") <<
" session [" << id << "] to docKey [" <<
_docKey << "] to have " << count << " sessions.");
return count;
}
@ -663,6 +662,16 @@ size_t DocumentBroker::removeSession(const std::string& id)
// Let the child know the client has disconnected.
const std::string msg("child-" + id + " disconnect");
_childProcess->sendTextFrame(msg);
const auto count = _sessions.size();
LOG_TRC("Removed " << (it->second->isReadOnly() ? "readonly" : "non-readonly") <<
" session [" << id << "] from docKey [" <<
_docKey << "] to have " << count << " sessions.");
return count;
}
else
{
LOG_TRC("Session [" << id << "] not found to remove from docKey [" << _docKey << "]");
}
}
catch (const std::exception& ex)

View file

@ -1032,10 +1032,7 @@ private:
}
LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri);
// Request the child to connect to us and add this session.
const auto sessionsCount = docBroker->addSession(session);
LOG_TRC(docKey << ", ws_sessions++: " << sessionsCount);
docBroker->addSession(session);
}
catch (const std::exception& exc)
{
@ -1043,6 +1040,7 @@ private:
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
auto lock = docBroker->getLock();
docBroker->removeSession(id);
if (docBroker->getSessionsCount() == 0 || !docBroker->isAlive())
{
LOG_INF("Removing unloaded DocumentBroker for docKey [" << docKey << "].");