Merge remote-tracking branch 'upstream/minor' into minor

This commit is contained in:
Lion Kortlepel
2026-05-23 18:22:08 +00:00
2 changed files with 15 additions and 13 deletions
-9
View File
@@ -98,15 +98,6 @@ TNetwork::TNetwork(TServer& Server, TPPSMonitor& PPSMonitor, TResourceManager& R
, mConnectionLimiter(MAX_CONCURRENT_CONNECTIONS, MAX_GLOBAL_CONNECTIONS) {
Application::SetSubsystemStatus("TCPNetwork", Application::Status::Starting);
Application::SetSubsystemStatus("UDPNetwork", Application::Status::Starting);
Application::RegisterShutdownHandler([&] {
beammp_debug("Kicking all players due to shutdown");
Server.ForEachClient([&](std::weak_ptr<TClient> client) -> bool {
if (auto Locked = client.lock()) {
ClientKick(*Locked, "Server shutdown");
}
return true;
});
});
Application::RegisterShutdownHandler([&] {
Application::SetSubsystemStatus("UDPNetwork", Application::Status::ShuttingDown);
if (mUDPThread.joinable()) {
+15 -4
View File
@@ -17,6 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "ArgsParser.h"
#include "Client.h"
#include "Common.h"
#include "Http.h"
#include "LuaAPI.h"
@@ -175,10 +176,6 @@ int BeamMPServerMain(MainArguments Arguments) {
Application::SetSubsystemStatus("Main", Application::Status::ShuttingDown);
Shutdown = true;
});
Application::RegisterShutdownHandler([] {
auto Futures = LuaAPI::MP::Engine->TriggerEvent("onShutdown", "");
TLuaEngine::WaitForAll(Futures, std::chrono::seconds(5));
});
TServer Server(Arguments.List);
@@ -200,6 +197,20 @@ int BeamMPServerMain(MainArguments Arguments) {
TPluginMonitor PluginMonitor(fs::path(Application::Settings.getAsString(Settings::Key::General_ResourceFolder)) / "Server", LuaEngine);
Application::RegisterShutdownHandler([] {
auto Futures = LuaAPI::MP::Engine->TriggerEvent("onShutdown", "");
TLuaEngine::WaitForAll(Futures, std::chrono::seconds(5));
});
Application::RegisterShutdownHandler([&Server, &Network] {
beammp_debug("Kicking all players due to shutdown");
Server.ForEachClient([&Network](std::weak_ptr<TClient> client) -> bool {
if (!client.expired()) {
Network.ClientKick(*client.lock(), "Server shutdown");
}
return true;
});
});
RegisterThread("Main(Waiting)");
std::set<std::string> IgnoreSubsystems {