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:
parent
1cf7a6bca1
commit
6b49ef326a
2 changed files with 18 additions and 11 deletions
|
@ -621,11 +621,6 @@ size_t DocumentBroker::addSession(std::shared_ptr<ClientSession>& session)
|
||||||
_lastEditableSession = false;
|
_lastEditableSession = false;
|
||||||
_markToDestroy = false;
|
_markToDestroy = false;
|
||||||
|
|
||||||
if (session->isReadOnly())
|
|
||||||
{
|
|
||||||
LOG_DBG("Adding a readonly session [" << id << "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_sessions.emplace(id, session).second)
|
if (!_sessions.emplace(id, session).second)
|
||||||
{
|
{
|
||||||
LOG_WRN("DocumentBroker: Trying to add already existing session.");
|
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.
|
// Request a new session from the child kit.
|
||||||
_childProcess->sendTextFrame(aMessage);
|
_childProcess->sendTextFrame(aMessage);
|
||||||
|
|
||||||
|
// Now we are ready to bridge between the kit and client.
|
||||||
|
session->bridgePrisonerSession();
|
||||||
|
|
||||||
// Tell the admin console about this new doc
|
// Tell the admin console about this new doc
|
||||||
Admin::instance().addDoc(_docKey, getPid(), getFilename(), id);
|
Admin::instance().addDoc(_docKey, getPid(), getFilename(), id);
|
||||||
|
|
||||||
// Now we are ready to bridge between the kit and client.
|
LOG_TRC("Added " << (session->isReadOnly() ? "readonly" : "non-readonly") <<
|
||||||
session->bridgePrisonerSession();
|
" session [" << id << "] to docKey [" <<
|
||||||
|
_docKey << "] to have " << count << " sessions.");
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -663,6 +662,16 @@ size_t DocumentBroker::removeSession(const std::string& id)
|
||||||
// Let the child know the client has disconnected.
|
// Let the child know the client has disconnected.
|
||||||
const std::string msg("child-" + id + " disconnect");
|
const std::string msg("child-" + id + " disconnect");
|
||||||
_childProcess->sendTextFrame(msg);
|
_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)
|
catch (const std::exception& ex)
|
||||||
|
|
|
@ -1032,10 +1032,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri);
|
LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri);
|
||||||
|
docBroker->addSession(session);
|
||||||
// Request the child to connect to us and add this session.
|
|
||||||
const auto sessionsCount = docBroker->addSession(session);
|
|
||||||
LOG_TRC(docKey << ", ws_sessions++: " << sessionsCount);
|
|
||||||
}
|
}
|
||||||
catch (const std::exception& exc)
|
catch (const std::exception& exc)
|
||||||
{
|
{
|
||||||
|
@ -1043,6 +1040,7 @@ private:
|
||||||
|
|
||||||
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
|
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
|
||||||
auto lock = docBroker->getLock();
|
auto lock = docBroker->getLock();
|
||||||
|
docBroker->removeSession(id);
|
||||||
if (docBroker->getSessionsCount() == 0 || !docBroker->isAlive())
|
if (docBroker->getSessionsCount() == 0 || !docBroker->isAlive())
|
||||||
{
|
{
|
||||||
LOG_INF("Removing unloaded DocumentBroker for docKey [" << docKey << "].");
|
LOG_INF("Removing unloaded DocumentBroker for docKey [" << docKey << "].");
|
||||||
|
|
Loading…
Reference in a new issue