[Libreoffice-commits] online.git: loolwsd/MasterProcessSession.cpp loolwsd/TileCache.cpp

Michael Meeks michael.meeks at collabora.com
Fri Apr 22 06:59:42 UTC 2016


 loolwsd/MasterProcessSession.cpp |    6 ++++++
 loolwsd/TileCache.cpp            |    9 +++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 60ffc8aa6b6d94ab694981789d19624ebeb1e5c3
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Apr 22 07:58:31 2016 +0100

    Avoid tile subscription loop, and elide redundant tile subscriptions.

diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 99f143e..dd1bdc4 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -204,6 +204,12 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                         auto subscriber = i.lock();
                         if (subscriber)
                         {
+                            if (subscriber.get() == this)
+                            {
+                                Log::debug("Refusing to queue new tile message for ourselves");
+                                continue;
+                            }
+
                             Log::debug("Sending tile message also to subscriber " + subscriber->getName() + " line: '" + firstLine + "'");
                             std::shared_ptr<BasicTileQueue> queue;
                             queue = subscriber->getQueue();
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp
index f05ffa6..4847135 100644
--- a/loolwsd/TileCache.cpp
+++ b/loolwsd/TileCache.cpp
@@ -46,6 +46,15 @@ using namespace LOOLProtocol;
 
 void TileBeingRendered::subscribe(const std::weak_ptr<MasterProcessSession>& session)
 {
+    std::shared_ptr<MasterProcessSession> cmp = session.lock();
+    for (auto s : _subscribers)
+    {
+        if (s.lock().get() == cmp.get())
+        {
+            Log::debug("Redundant request to re-subscribe on a tile");
+            return;
+        }
+    }
     _subscribers.push_back(session);
 }
 


More information about the Libreoffice-commits mailing list