Fixed performance bug in standalone netconsole

When unconnected, the frame loop would run as fast as it could. Moved thread sleeper at the bottom in the outer scope of the function to prevent this behavior in all cases.
This commit is contained in:
Kawe Mazidjatari 2023-04-16 01:00:07 +02:00
parent 096091e56f
commit 9287f00841

View File

@ -200,9 +200,7 @@ void CNetCon::RunFrame(void)
{
if (m_bConnEstablished)
{
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::lock_guard<std::mutex> l(m_Mutex);
this->Recv();
}
else if (m_bPromptConnect)
@ -210,6 +208,7 @@ void CNetCon::RunFrame(void)
DevMsg(eDLL_T::NONE, "Enter [<IP>]:<PORT> or <IP> <PORT>: ");
m_bPromptConnect = false;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
//-----------------------------------------------------------------------------