TESTING: Move server stuff to a server session config for central/global resources

This commit is contained in:
2026-02-09 14:20:26 +01:00
parent 6d40dbe00d
commit 316498c745
9 changed files with 213 additions and 56 deletions

View File

@@ -27,16 +27,13 @@ namespace ColumnLynx::Net::TCP {
}
Utils::error("Accept failed: " + ec.message());
// Try again only if still running
if (mHostRunning && *mHostRunning && mAcceptor.is_open())
if (ServerSession::getInstance().isHostRunning() && mAcceptor.is_open())
mStartAccept();
return;
}
auto client = TCPConnection::create(
std::move(socket),
mSodiumWrapper,
&mRawServerConfig,
mConfigDirPath,
[this](std::shared_ptr<TCPConnection> c) {
mClients.erase(c);
Utils::log("Client removed.");
@@ -46,7 +43,7 @@ namespace ColumnLynx::Net::TCP {
client->start();
Utils::log("Accepted new client connection.");
if (mHostRunning && *mHostRunning && mAcceptor.is_open())
if (ServerSession::getInstance().isHostRunning() && mAcceptor.is_open())
mStartAccept();
}
);