Skip to content

Commit

Permalink
wsd: SessionId -> ConnectionId
Browse files Browse the repository at this point in the history
"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 <[email protected]>
Tested-by: Ashod Nakashian <[email protected]>
  • Loading branch information
Ashod committed Sep 22, 2019
1 parent fd5581e commit 477d671
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions wsd/Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@ 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)
: WebSocketHandler(true),
_admin(adminManager),
_isAuthenticated(true)
{
_sessionId = Util::decodeId(LOOLWSD::GenSessionId());
_sessionId = Util::decodeId(LOOLWSD::GetConnectionId());
}

void AdminSocketHandler::sendTextFrame(const std::string& message)
Expand Down
4 changes: 2 additions & 2 deletions wsd/LOOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -2077,7 +2077,7 @@ class ClientRequestDispatcher : public SocketHandlerInterface
/// 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.");
}
Expand Down
6 changes: 3 additions & 3 deletions wsd/LOOLWSD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LOOLWSD : public Poco::Util::ServerApplication

// 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;
Expand Down Expand Up @@ -85,9 +85,9 @@ class LOOLWSD : public Poco::Util::ServerApplication
/// 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()
Expand Down

0 comments on commit 477d671

Please sign in to comment.