hotfix: multithread loading

This commit is contained in:
semenov
2025-08-07 16:47:15 +03:00
parent 28ea4338e0
commit d58835d9d6
12 changed files with 338 additions and 312 deletions

View File

@@ -60,14 +60,14 @@ void ProcessParser::slot_read(ClientHandler *client, QByteArray array)
}
else if(xmlReader.name() == "ListTasksAMM")
{
if(client->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{//Отчет по задаче АММ от Юнити-клиента
clientUnityTaskAMMreport(xmlReader,client, array);
}
}
else if(xmlReader.name() == "ListTasksFIM")
{
if(client->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{//Отчет по задаче FIM от Юнити-клиента
clientUnityTaskFIMreport(xmlReader,client, array);
}

View File

@@ -50,7 +50,7 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
processingSystem->processingClientQueryToDB(handler, queryToDB);
}
if(handler->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;

View File

@@ -525,7 +525,7 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif
else if(clientNotify.Code == commandStartTimerClient)
{
//Фиксируем время входа Юнити-клиента
if (client->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if (client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
processingEntryUnityClient(client);
}
@@ -535,7 +535,7 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif
qDebug() << "processing thread: " << QThread::currentThreadId();
//Фиксируем время выхода Юнити-клиента
if (client->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if (client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
processingExitUnityClient(client);
}
@@ -667,7 +667,7 @@ void ProcessingSystem::sendTaskFIMToClient(ClientHandler *client, int id_trainee
void ProcessingSystem::sendTaskListToUnity(ClientHandler *client)
{
//Отправка списков задач клиенту Юнити
if(client->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
QString login = client->getClient()->getLogin();
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
@@ -694,7 +694,7 @@ ClientHandler *ProcessingSystem::getUnityClientById(int id)
ClientHandler *handler = server->getClientsMap()->value(idSocket);
if(handler->getClient()->getLogin() == login)
{
if(handler->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
return handler;
}

View File

@@ -34,7 +34,7 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
void RecognizeSystem::recognize()
{
mutex->lock();
QMutexLocker locker(mutex);
qDebug() << "Recognize thread ID " << QThread::currentThreadId();
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
@@ -61,7 +61,7 @@ void RecognizeSystem::recognize()
continue;
}
if(client->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
char *read = new char[4];
stream.readRawData(read,4);
@@ -110,7 +110,7 @@ void RecognizeSystem::recognize()
if (packetType == PacketType::TYPE_XMLANSWER)
{
if(clientHandler->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(clientHandler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
data = socket->readAll();
}
@@ -130,7 +130,7 @@ void RecognizeSystem::recognize()
if(packetType == PacketType::TYPE_BIGXML)
{
if (clientHandler->getClient()->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if (clientHandler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
char *readBuffer = new char[4];
socket->read(readBuffer,4);
@@ -183,7 +183,7 @@ void RecognizeSystem::recognize()
if(packetType == PacketType::TYPE_FOLDER) //создание папок
{
if(client->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
filePath = socket->readAll();
filePath = Tools::createSharedPath(filePath);
@@ -215,7 +215,7 @@ void RecognizeSystem::recognize()
if (packetType == PacketType::TYPE_FILE) //выгрузка одного файла
{
if(client->GETTYPE() == TypeClientAutorization::TYPE_UNITY_CLIENT)
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
DataInfo *currentFileData = updateController->getCurrentDataInfo();
filePath = currentFileData->path;
@@ -311,7 +311,7 @@ void RecognizeSystem::recognize()
if(socket->state() == QAbstractSocket::UnconnectedState){
qDebug() << "UNCONNECT";
mutex->unlock();
//mutex->unlock();
file.close();
return;
}
@@ -435,7 +435,7 @@ void RecognizeSystem::recognize()
packetType = PacketType::TYPE_NONE;
}
mutex->unlock();
//mutex->unlock();
}
void RecognizeSystem::packetTypeInit(PacketType packet,Client *client)
@@ -444,7 +444,7 @@ void RecognizeSystem::packetTypeInit(PacketType packet,Client *client)
{
client->setUnity(TypeClientAutorization::TYPE_QT_CLIENT);
qDebug() << "ConnectionType isUnity: " << client->GETTYPE();
qDebug() << "ConnectionType isUnity: " << client->getClientType();
}
else if (packet == PacketType::TYPE_UNITY)
{

View File

@@ -19,7 +19,7 @@ void SendSystem::initialize(DataParser *dataParser,QMutex *globalMutex)
void SendSystem::setClient(Client *client,QTcpSocket *socket)
{
this->socket = socket;
this->type = client->GETTYPE();
this->type = client->getClientType();
this->client = client;
isSendStopped = false;
}
@@ -86,8 +86,8 @@ void SendSystem::sendFileBlock(QString path)
void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
{
qDebug() << "sendFileBlockByteArray thread: " << QThread::currentThreadId();
if(client->GETTYPE() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->GETTYPE() == TypeClientAutorization::TYPE_GUI)
if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
@@ -179,7 +179,6 @@ void SendSystem::sendFolderBlock(QString path)
stream << PacketType::TYPE_FOLDER;
stream << path;
socket->waitForReadyRead(100);
}
void SendSystem::sendDeleteBlock(QString path)
@@ -195,8 +194,8 @@ void SendSystem::sendDeleteBlock(QString path)
void SendSystem::sendPacketType(PacketType packetType)
{
if (client->GETTYPE() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->GETTYPE() == TypeClientAutorization::TYPE_GUI)
if (client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
@@ -228,8 +227,8 @@ void SendSystem::sendNotify(QString notify)
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
{
qDebug() << "SendSystemThread: " << QThread::currentThreadId();
if (client->GETTYPE() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->GETTYPE() == TypeClientAutorization::TYPE_GUI)
if (client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
@@ -262,7 +261,7 @@ void SendSystem::sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64
void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList){
mutex->lock();
QMutexLocker locker(mutex);
QListIterator<FileData> clientIterator(deleteList);
while(clientIterator.hasNext())
@@ -272,7 +271,6 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
sendDeleteBlock(data.path);
if(getIsSendStopped())
{
mutex->unlock();
return;
}
}
@@ -296,16 +294,11 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
if(isSendStopped)
{
mutex->unlock();
return;
}
}
emit sigLoadHash();
sendPacketType(PacketType::TYPE_FINISH);
socket->waitForBytesWritten();
mutex->unlock();
}
void SendSystem::socketWrite(QByteArray array)

View File

@@ -546,8 +546,8 @@ QList<FileData> UpdateController::getFileDeleteList() const
QList<FileData> UpdateController::getFileSendList()
{
QList<FileData> sendList = *assetManager->prepareRealPathList(&fileSendList);
QList<FileData> *copy = new QList<FileData>(fileSendList);
QList<FileData> sendList = *assetManager->prepareRealPathList(copy);
return sendList;
}