[Libreoffice-commits] online.git: wsd/Admin.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 22 18:20:43 UTC 2019


 wsd/Admin.cpp   |    4 ++--
 wsd/LOOLWSD.cpp |    4 ++--
 wsd/LOOLWSD.hpp |    6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 477d6714d995a78e1c5f501541eeb7d72fe7513f
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Sep 21 14:15:37 2019 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Sun Sep 22 20:20:24 2019 +0200

    wsd: SessionId -> ConnectionId
    
    "Session" is too generic and can be misleading.
    This is really a connection ID, or a connection-session ID,
    so it's more sensible to call it ConnectionId to
    signify that it's a connection-specific ID.
    
    Change-Id: I0f12b1cf80d4853a27535101093ef6b7a3e0d438
    Reviewed-on: https://gerrit.libreoffice.org/79326
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index cb8c43ceb..319503b69 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -274,7 +274,7 @@ AdminSocketHandler::AdminSocketHandler(Admin* adminManager,
       _isAuthenticated(false)
 {
     // Different session id pool for admin sessions (?)
-    _sessionId = Util::decodeId(LOOLWSD::GenSessionId());
+    _sessionId = Util::decodeId(LOOLWSD::GetConnectionId());
 }
 
 AdminSocketHandler::AdminSocketHandler(Admin* adminManager)
@@ -282,7 +282,7 @@ AdminSocketHandler::AdminSocketHandler(Admin* adminManager)
       _admin(adminManager),
       _isAuthenticated(true)
 {
-    _sessionId = Util::decodeId(LOOLWSD::GenSessionId());
+    _sessionId = Util::decodeId(LOOLWSD::GetConnectionId());
 }
 
 void AdminSocketHandler::sendTextFrame(const std::string& message)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index f84a73238..bc971eb38 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -688,7 +688,7 @@ inline std::string getAdminURI(const Poco::Util::LayeredConfiguration &config)
 
 #endif // MOBILEAPP
 
-std::atomic<uint64_t> LOOLWSD::NextSessionId;
+std::atomic<uint64_t> LOOLWSD::NextConnectionId(1);
 
 #ifndef KIT_IN_PROCESS
 std::atomic<int> LOOLWSD::ForKitWritePipe(-1);
@@ -2077,7 +2077,7 @@ private:
     /// Set the socket associated with this ResponseClient.
     void onConnect(const std::shared_ptr<StreamSocket>& socket) override
     {
-        _id = LOOLWSD::GenSessionId();
+        _id = LOOLWSD::GetConnectionId();
         _socket = socket;
         LOG_TRC("#" << socket->getFD() << " Connected to ClientRequestDispatcher.");
     }
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index f8708b63d..0253d08b2 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -46,7 +46,7 @@ public:
 
     // An Application is a singleton anyway,
     // so just keep these as statics.
-    static std::atomic<uint64_t> NextSessionId;
+    static std::atomic<uint64_t> NextConnectionId;
     static unsigned int NumPreSpawnedChildren;
     static bool NoCapsForKit;
     static bool NoSeccomp;
@@ -85,9 +85,9 @@ public:
     /// For testing only [!] DocumentBrokers are mostly single-threaded with their own thread
     static std::vector<std::shared_ptr<DocumentBroker>> getBrokersTestOnly();
 
-    static std::string GenSessionId()
+    static std::string GetConnectionId()
     {
-        return Util::encodeId(++NextSessionId, 4);
+        return Util::encodeId(NextConnectionId++, 3);
     }
 
     static bool isSSLEnabled()


More information about the Libreoffice-commits mailing list