[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue Jan 3 05:58:35 UTC 2017
wsd/DocumentBroker.cpp | 23 ++++++++++++++++-------
wsd/LOOLWSD.cpp | 6 ++----
2 files changed, 18 insertions(+), 11 deletions(-)
New commits:
commit 6b49ef326a837026065dd203746f7715d8c379c4
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Jan 3 00:12:15 2017 -0500
wsd: better logging when adding/removing sessions
Change-Id: Ie11886390687c744e1a0f60bff4317898c36f9c2
Reviewed-on: https://gerrit.libreoffice.org/32675
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index a9a2dac..53ead02 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -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)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index cd176da..13ab14f 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -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 << "].");
More information about the Libreoffice-commits
mailing list