From 2805c3fb2fa1457471d997d4d610349cd43be981 Mon Sep 17 00:00:00 2001 From: Edo Date: Fri, 12 May 2023 20:11:01 +0100 Subject: [PATCH] [Network]: Fix potential dead-lock (#1031) --- src/Components/Modules/Network.cpp | 8 ++++++++ src/Components/Modules/QuickPatch.cpp | 25 ------------------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/Components/Modules/Network.cpp b/src/Components/Modules/Network.cpp index cdc0e1db..99c57784 100644 --- a/src/Components/Modules/Network.cpp +++ b/src/Components/Modules/Network.cpp @@ -409,6 +409,14 @@ namespace Components Utils::Hook::Set(0x682170, 0xC3); // Telling LSP that we're playing a private match Utils::Hook::Nop(0x4FD448, 5); // Don't create lsp_socket + // Do not run UPNP stuff at all + Utils::Hook::Set(0x48A135, 0xC3); + Utils::Hook::Set(0x48A151, 0xC3); + Utils::Hook::Nop(0x684080, 5); // Don't spam the console + + // Disable the IWNet IP detection (default 'got ipdetect' flag to 1) + Utils::Hook::Set(0x649D6F0, 1); + OnClientPacket("resolveAddress", []([[maybe_unused]] const Address& address, [[maybe_unused]] const std::string& data) { SendRaw(address, address.getString()); diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index c8c900cf..8ea1cafb 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -369,31 +369,6 @@ namespace Components // remove limit on IWD file loading Utils::Hook::Set(0x642BF3, 0xEB); - // dont run UPNP stuff on main thread - Utils::Hook::Set(0x48A135, 0xC3); - Utils::Hook::Set(0x48A151, 0xC3); - Utils::Hook::Nop(0x684080, 5); // Don't spam the console - - // spawn upnp thread when UPNP_init returns - Utils::Hook::Hook(0x47982B, []() - { - std::thread([] - { - Com_InitThreadData(); - - // check natpmpstate - // state 4 is no more devices to query - while (Utils::Hook::Get(0x66CE200) < 4) - { - Utils::Hook::Call(0x4D7030)(); - Game::Sys_Sleep(500); - } - }).detach(); - }, HOOK_JUMP).install()->quick(); - - // disable the IWNet IP detection (default 'got ipdetect' flag to 1) - Utils::Hook::Set(0x649D6F0, 1); - // Fix stats sleeping Utils::Hook::Set(0x6832BA, 0xEB); Utils::Hook::Set(0x4BD190, 0xC3);