Разблокировка при вылете АРМ Инструктора

This commit is contained in:
2026-01-22 15:48:27 +03:00
parent 5415afe264
commit ebbfc484b4

View File

@@ -44,7 +44,7 @@ bool MultiThreadServer::startServer()
{ {
stateServer = started; stateServer = started;
slot_BlockAutorization(false, "SERVER", "StartServer"); slot_BlockAutorization(false, "SERVER", "StopServer");
Logger::instance().log("SERVER: start OK"); Logger::instance().log("SERVER: start OK");
return true; return true;
} }
@@ -158,6 +158,10 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
{ {
if(whoFullName == "SERVER") if(whoFullName == "SERVER")
{ {
if(type == "StopServer")
{
blockersMap.clear();
}
this->blockAutorization(); this->blockAutorization();
blockersMap.insert(key, type); blockersMap.insert(key, type);
blockRes = true; blockRes = true;
@@ -195,8 +199,25 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
} }
} }
else else
{
if(type == "DeAuthorizationInstructor")
{
QStringList listKeyForDel;
for(QString keyLocal : blockersMap.keys())
{
if(keyLocal.contains(whoFullName))
listKeyForDel.append(keyLocal);
}
for(QString keyLocal : listKeyForDel)
{
blockersMap.take(keyLocal);
}
}
else
{ {
blockersMap.take(key); blockersMap.take(key);
}
if(!blockersMap.count()) if(!blockersMap.count())
{ {
this->unBlockAutorization(); this->unBlockAutorization();
@@ -215,7 +236,7 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
else else
emit signal_sendPacketToAllClients(PacketType::FREE); emit signal_sendPacketToAllClients(PacketType::FREE);
foreach(QString keyLocal, blockersMap.keys()) for(QString keyLocal : blockersMap.keys())
{ {
if(strTypes != "") if(strTypes != "")
strTypes += ", "; strTypes += ", ";