diff --git a/src/Components/Modules/Flags.cpp b/src/Components/Modules/Flags.cpp index 2075a338..e43ead5e 100644 --- a/src/Components/Modules/Flags.cpp +++ b/src/Components/Modules/Flags.cpp @@ -29,7 +29,6 @@ namespace Components if (wFlag[0] == L'-') { Flags::EnabledFlags.push_back(std::string(++wFlag.begin(), wFlag.end())); - OutputDebugStringA(Flags::EnabledFlags[Flags::EnabledFlags.size() - 1].data()); } } } diff --git a/src/Components/Modules/Network.cpp b/src/Components/Modules/Network.cpp index 3fc1c8bc..638c7403 100644 --- a/src/Components/Modules/Network.cpp +++ b/src/Components/Modules/Network.cpp @@ -140,17 +140,19 @@ namespace Components int Network::PacketInterceptionHandler(const char* packet) { + std::string packetCommand = packet; + auto pos = packetCommand.find_first_of("\\\n "); + if (pos != std::string::npos) + { + packetCommand = packetCommand.substr(0, pos); + } + + packetCommand = Utils::StrToLower(packetCommand); + // Check if custom handler exists for (auto i = Network::PacketHandlers.begin(); i != Network::PacketHandlers.end(); i++) { - std::string packetCommand = packet; - auto pos = packetCommand.find_first_of("\n "); - if (pos != std::string::npos) - { - packetCommand = packetCommand.substr(0, pos); - } - - if (Utils::StrToLower(i->first) == Utils::StrToLower(packetCommand)) + if (Utils::StrToLower(i->first) == packetCommand) { Network::SelectedPacket = i->first; return 0; diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index a0fbc629..c7418cd2 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -163,9 +163,9 @@ namespace Components } } - void ServerList::InsertRequest(Network::Address address, bool accquireMutex) + void ServerList::InsertRequest(Network::Address address, bool acquireMutex) { - if (accquireMutex) ServerList::RefreshContainer.Mutex.lock(); + if (acquireMutex) ServerList::RefreshContainer.Mutex.lock(); ServerList::Container::ServerContainer container; container.Sent = false; @@ -187,7 +187,7 @@ namespace Components ServerList::RefreshContainer.SendCount++; } - if (accquireMutex) ServerList::RefreshContainer.Mutex.unlock(); + if (acquireMutex) ServerList::RefreshContainer.Mutex.unlock(); } void ServerList::Insert(Network::Address address, Utils::InfoString info) @@ -250,8 +250,6 @@ namespace Components ServerList::GetList().push_back(server); ServerList::VisibleList.push_back(index); ServerList::SortList(); - - OutputDebugStringA(Utils::VA("Inserted with IP: %s", server.Addr.GetString())); } break; @@ -310,7 +308,7 @@ namespace Components void ServerList::Frame() { - ServerList::RefreshContainer.Mutex.lock(); + if (!ServerList::RefreshContainer.Mutex.try_lock()) return; if (ServerList::RefreshContainer.AwatingList) { diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index ba04d128..6f6285a0 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -27,7 +27,7 @@ namespace Components static void Refresh(); static void RefreshVisibleList(); - static void InsertRequest(Network::Address address, bool accquireMutex = true); + static void InsertRequest(Network::Address address, bool acquireMutex = true); static void Insert(Network::Address address, Utils::InfoString info); static bool IsFavouriteList();