[Session] Don't start thread during unit tests
This commit is contained in:
parent
276ab43351
commit
5036fb2e84
@ -107,16 +107,19 @@ namespace Components
|
|||||||
Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512);
|
Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512);
|
||||||
//Scheduler::OnFrame(Session::RunFrame);
|
//Scheduler::OnFrame(Session::RunFrame);
|
||||||
|
|
||||||
Session::Terminate = false;
|
if (!Loader::PerformingUnitTests())
|
||||||
Session::Thread = std::thread([]()
|
|
||||||
{
|
{
|
||||||
while (!Session::Terminate)
|
Session::Terminate = false;
|
||||||
|
Session::Thread = std::thread([]()
|
||||||
{
|
{
|
||||||
Session::RunFrame();
|
while (!Session::Terminate)
|
||||||
Session::HandleSignatures();
|
{
|
||||||
std::this_thread::sleep_for(20ms);
|
Session::RunFrame();
|
||||||
}
|
Session::HandleSignatures();
|
||||||
});
|
std::this_thread::sleep_for(20ms);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Network::Handle("sessionSyn", [](Network::Address address, std::string data)
|
Network::Handle("sessionSyn", [](Network::Address address, std::string data)
|
||||||
{
|
{
|
||||||
@ -165,6 +168,7 @@ namespace Components
|
|||||||
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
std::lock_guard<std::recursive_mutex> _(Session::Mutex);
|
||||||
Session::PacketHandlers.clear();
|
Session::PacketHandlers.clear();
|
||||||
Session::PacketQueue.clear();
|
Session::PacketQueue.clear();
|
||||||
|
Session::SignatureQueue = std::queue<std::pair<Network::Address, std::string>>();
|
||||||
|
|
||||||
Session::SignatureKey.free();
|
Session::SignatureKey.free();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user