[Libreoffice-commits] online.git: 2 commits - loolwsd/ChildSession.cpp loolwsd/ChildSession.hpp loolwsd/LOOLKit.cpp loolwsd/Util.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Oct 23 21:21:14 UTC 2016


 loolwsd/ChildSession.cpp |    2 +-
 loolwsd/ChildSession.hpp |    2 +-
 loolwsd/LOOLKit.cpp      |   13 +++++++------
 loolwsd/Util.cpp         |    2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit b78e224f8dc1c88ec99cff2d6b8f636bd4735d90
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Oct 23 16:11:22 2016 -0400

    loolwsd: log the invalid/dead PID in exception
    
    Change-Id: Ib523e34de3b354944c53ce0e6b5a7cab8fdb8cf3
    Reviewed-on: https://gerrit.libreoffice.org/30215
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 1f53d7e..ffcbf03 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -510,7 +510,7 @@ namespace Util
         }
         catch(const std::exception&)
         {
-            Log::warn() << "Trying to find memory of invalid/dead PID" << Log::end;
+            Log::warn() << "Trying to find memory of invalid/dead PID " << nPid << Log::end;
         }
 
         return nMem;
commit 5802d7e8a1b6ada4963ef02403f7835ebbd2d38c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Oct 23 16:46:05 2016 -0400

    loolwsd: show disconnected usernames in the document repair
    
    By retaining the view-ID to username mapping of disconnected
    users we are able to show a disconnected username in the
    document repair dialog.
    
    Change-Id: Id08790de31f92653381b6a1525caf044bd875479
    Reviewed-on: https://gerrit.libreoffice.org/30216
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index 7ce377b..4e1243f 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -466,7 +466,7 @@ bool ChildSession::getCommandValues(const char* /*buffer*/, int /*length*/, Stri
                                         std::string(pValues == nullptr ? "" : pValues),
                                         std::string(pUndo == nullptr ? "" : pUndo));
         // json only contains view IDs, insert matching user names.
-        std::map<int, std::string> viewInfo =_docManager.getViewInfo();
+        std::map<int, std::string> viewInfo = _docManager.getViewInfo();
         insertUserNames(viewInfo, json);
         success = sendTextFrame("commandvalues: " + json);
         std::free(pValues);
diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index c901cf0..ccd0720 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -75,7 +75,7 @@ public:
     bool getPartPageRectangles(const char *buffer, int length);
     int getViewId() const { return _viewId; }
     void setViewId(const int viewId) { _viewId = viewId; }
-    const std::string getViewUserName() const { return _userName; }
+    const std::string& getViewUserName() const { return _userName; }
 
     void loKitCallback(const int nType, const std::string& rPayload);
 
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 0ddcac5..b88126a 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -851,14 +851,13 @@ private:
 
         for (auto& pair : _sessions)
         {
-            const auto session = pair.second;
-            if (!session->isCloseFrame())
-            {
-                const auto viewId = session->getViewId();
-                viewInfo[viewId] = session->getViewUserName();
-            }
+            const auto& session = pair.second;
+            const auto viewId = session->getViewId();
+            viewInfo[viewId] = session->getViewUserName();
         }
 
+        viewInfo.insert(_oldSessionIds.begin(), _oldSessionIds.end());
+
         return viewInfo;
     }
 
@@ -1133,6 +1132,7 @@ private:
                 if (message == "disconnect")
                 {
                     Log::debug("Removing ChildSession " + viewId);
+                    _oldSessionIds[it->second->getViewId()] = it->second->getViewUserName();
                     _sessions.erase(it);
                     return true;
                 }
@@ -1271,6 +1271,7 @@ private:
     std::atomic_size_t _isLoading;
     std::map<int, std::unique_ptr<CallbackDescriptor>> _viewIdToCallbackDescr;
     std::map<std::string, std::shared_ptr<ChildSession>> _sessions;
+    std::map<int, std::string> _oldSessionIds;
     Poco::Thread _callbackThread;
     std::atomic_size_t _clientViews;
 };


More information about the Libreoffice-commits mailing list