From 208b68f2181f823e10cca1aeb15e9f2d004f5181 Mon Sep 17 00:00:00 2001 From: Diavolo Date: Thu, 27 Jul 2023 17:55:35 +0200 Subject: [PATCH] fix(node): make node system responsive --- src/Components/Modules/Node.cpp | 4 +--- src/Components/Modules/ServerList.cpp | 10 +++------- src/Components/Modules/ServerList.hpp | 1 - 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Components/Modules/Node.cpp b/src/Components/Modules/Node.cpp index 4f170bb4..630b389e 100644 --- a/src/Components/Modules/Node.cpp +++ b/src/Components/Modules/Node.cpp @@ -184,8 +184,6 @@ namespace Components if (!Dedicated::IsEnabled()) { - if (ServerList::UseMasterServer) return; // don't run node frame if master server is active - if (Game::CL_GetLocalClientConnectionState(0) != Game::CA_DISCONNECTED) { WasIngame = true; @@ -266,7 +264,7 @@ namespace Components if (list.isnode() && (!list.port() || list.port() == address.getPort())) { - if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && !ServerList::UseMasterServer && list.protocol() == PROTOCOL) + if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && list.protocol() == PROTOCOL) { #ifdef NODE_SYSTEM_DEBUG Logger::Debug("Inserting {} into the serverlist", address.getString()); diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index 06668ad3..89dabe28 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -29,8 +29,6 @@ namespace Components Dvar::Var ServerList::NETServerQueryLimit; Dvar::Var ServerList::NETServerFrames; - bool ServerList::UseMasterServer = true; - std::vector* ServerList::GetList() { if (IsOnlineList()) @@ -293,6 +291,7 @@ namespace Components { Discovery::Perform(); } +#ifdef IW4_USE_MASTER_SERVER else if (IsOnlineList()) { const auto masterPort = (*Game::com_masterPort)->current.integer; @@ -319,6 +318,7 @@ namespace Components Logger::Print("Sending server list request to master\n"); Network::SendCommand(RefreshContainer.host, "getservers", std::format("IW4 {} full empty", PROTOCOL)); } +#endif else if (IsFavouriteList()) { LoadFavourties(); @@ -730,10 +730,6 @@ namespace Components { RefreshContainer.awatingList = false; - Logger::Print("We haven't received a response from the master within {} seconds!\n", (Game::Sys_Milliseconds() - RefreshContainer.awaitTime) / 1000); - Toast::Show("net_disconnect", "^2Notice", "Master server could not be reached. Switching to decentralized network", 3000); - - UseMasterServer = false; Node::Synchronize(); } } @@ -892,7 +888,7 @@ namespace Components }); // Set default masterServerName + port and save it - Utils::Hook::Set(0x60AD92, "master.xlabs.dev"); + Utils::Hook::Set(0x60AD92, "server.alterware.dev"); Utils::Hook::Set(0x60AD90, Game::DVAR_NONE); // masterServerName Utils::Hook::Set(0x60ADC6, Game::DVAR_NONE); // masterPort diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index a3820f14..6526104a 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -52,7 +52,6 @@ namespace Components static void UpdateVisibleInfo(); static bool GetMasterServer(const char* ip, int port, Game::netadr_t& address); - static bool UseMasterServer; static Dvar::Var UIServerSelected; static Dvar::Var UIServerSelectedMap;