[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/DocumentBroker.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Nov 7 06:36:41 UTC 2016


 loolwsd/DocumentBroker.cpp |   21 ++-------------------
 loolwsd/DocumentBroker.hpp |    2 --
 2 files changed, 2 insertions(+), 21 deletions(-)

New commits:
commit 11a0d016cabf13b990f975af8d06b44ca15cd8bf
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Nov 6 21:55:37 2016 -0500

    loolwsd: inline and simplify connectPeers
    
    Change-Id: I64fbeefa59573eb9e467dc18ecbf75ebd72b3be4
    Reviewed-on: https://gerrit.libreoffice.org/30638
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 1462d3c..cbc710c 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -509,29 +509,12 @@ size_t DocumentBroker::addSession(std::shared_ptr<ClientSession>& session)
     auto prisonerSession = std::make_shared<PrisonerSession>(id, shared_from_this());
 
     // Connect the prison session to the client.
-    if (!connectPeers(prisonerSession))
-    {
-        LOG_WRN("Failed to connect " << session->getName() << " to its peer.");
-    }
+    session->setPeer(prisonerSession);
+    prisonerSession->setPeer(session);
 
     return _sessions.size();
 }
 
-bool DocumentBroker::connectPeers(std::shared_ptr<PrisonerSession>& session)
-{
-    const auto id = session->getId();
-
-    auto it = _sessions.find(id);
-    if (it != _sessions.end())
-    {
-        it->second->setPeer(session);
-        session->setPeer(it->second);
-        return true;
-    }
-
-    return false;
-}
-
 size_t DocumentBroker::removeSession(const std::string& id)
 {
     Util::assertIsLocked(_mutex);
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 73b1697..fdb7fac 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -221,8 +221,6 @@ public:
 
     /// Add a new session. Returns the new number of sessions.
     size_t addSession(std::shared_ptr<ClientSession>& session);
-    /// Connect a prison session to its client peer.
-    bool connectPeers(std::shared_ptr<PrisonerSession>& session);
     /// Removes a session by ID. Returns the new number of sessions.
     size_t removeSession(const std::string& id);
 


More information about the Libreoffice-commits mailing list