[Network]: Fix potential dead-lock (#1031)

This commit is contained in:
Edo 2023-05-12 20:11:01 +01:00 committed by GitHub
parent d3775d2565
commit 2805c3fb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 25 deletions

View File

@ -409,6 +409,14 @@ namespace Components
Utils::Hook::Set<std::uint8_t>(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<std::uint8_t>(0x48A135, 0xC3);
Utils::Hook::Set<std::uint8_t>(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<std::uint8_t>(0x649D6F0, 1);
OnClientPacket("resolveAddress", []([[maybe_unused]] const Address& address, [[maybe_unused]] const std::string& data)
{
SendRaw(address, address.getString());

View File

@ -369,31 +369,6 @@ namespace Components
// remove limit on IWD file loading
Utils::Hook::Set<BYTE>(0x642BF3, 0xEB);
// dont run UPNP stuff on main thread
Utils::Hook::Set<BYTE>(0x48A135, 0xC3);
Utils::Hook::Set<BYTE>(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<int>(0x66CE200) < 4)
{
Utils::Hook::Call<void()>(0x4D7030)();
Game::Sys_Sleep(500);
}
}).detach();
}, HOOK_JUMP).install()->quick();
// disable the IWNet IP detection (default 'got ipdetect' flag to 1)
Utils::Hook::Set<BYTE>(0x649D6F0, 1);
// Fix stats sleeping
Utils::Hook::Set<BYTE>(0x6832BA, 0xEB);
Utils::Hook::Set<BYTE>(0x4BD190, 0xC3);