feat(Core): Linux: Support systemd socket activation for the worldserver game socket (#21998)

This commit is contained in:
Quentin Dawans
2025-11-29 21:53:48 +01:00
committed by GitHub
parent 77349fde48
commit dc8318cf6a
6 changed files with 144 additions and 20 deletions

View File

@@ -48,6 +48,7 @@
#include "SecretMgr.h"
#include "SharedDefines.h"
#include "SteadyTimer.h"
#include "Systemd.h"
#include "World.h"
#include "WorldSessionMgr.h"
#include "WorldSocket.h"
@@ -406,7 +407,8 @@ int main(int argc, char** argv)
sScriptMgr->OnShutdown();
// set server offline
LoginDatabase.DirectExecute("UPDATE realmlist SET flag = flag | {} WHERE id = '{}'", REALM_FLAG_OFFLINE, realm.Id.Realm);
if (!sConfigMgr->GetOption<bool>("Network.UseSocketActivation", false))
LoginDatabase.DirectExecute("UPDATE realmlist SET flag = flag | {} WHERE id = '{}'", REALM_FLAG_OFFLINE, realm.Id.Realm);
LOG_INFO("server.worldserver", "Halting process...");

View File

@@ -397,6 +397,20 @@ Network.TcpNodelay = 1
Network.EnableProxyProtocol = 0
#
# Network.UseSocketActivation
# Description: Enable systemd socket activation support for the worldserver.
# When enabled and the process is started by systemd socket activation,
# the server will use the socket passed by systemd instead of
# creating and binding its own listening socket. Disabled by default.
#
# When enabled the realm is not automatically set as offline on shutdown.
#
# Example: 1 - (Enabled)
# Default: 0 - (Disabled)
Network.UseSocketActivation = 0
#
###################################################################################################