From 7e27584c5a2db3b2900922d3f5ee3e4ba3e171d4 Mon Sep 17 00:00:00 2001 From: semenov Date: Thu, 20 Nov 2025 13:04:36 +0300 Subject: [PATCH] bugfix: segregate send and delete list to client --- DOCS/Алексей/Board.md | 1 + ServerLMS/Data/Client.h | 28 ++++++++++++++++- ServerLMS/Systems/recognizesystem.cpp | 6 ++-- ServerLMS/Systems/sendsystem.cpp | 3 -- ServerLMS/Systems/updatecontroller.cpp | 42 +++++++++----------------- ServerLMS/Systems/updatecontroller.h | 6 +--- 6 files changed, 47 insertions(+), 39 deletions(-) diff --git a/DOCS/Алексей/Board.md b/DOCS/Алексей/Board.md index 3265293..d197cd5 100644 --- a/DOCS/Алексей/Board.md +++ b/DOCS/Алексей/Board.md @@ -16,6 +16,7 @@ kanban-plugin: board - [ ] Отменить изменения работает некрасиво - [ ] BUSY не меняет иконку блокировки - [ ] не работают ссылки при выгрузке в QT Client +- [ ] починить поведение окон при включенном обновлении у 2х пользователей ## feature client Unity diff --git a/ServerLMS/Data/Client.h b/ServerLMS/Data/Client.h index fac4820..4593183 100644 --- a/ServerLMS/Data/Client.h +++ b/ServerLMS/Data/Client.h @@ -19,7 +19,7 @@ public: this->port = port; this->fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login; }; - ~Client(); + ~Client(){}; public: QString getFullName() @@ -127,6 +127,28 @@ public: clientHash = value; } + QList getFileSendList() const + { + return fileSendList; + } + + void setFileSendList(const QList &value) + { + fileSendList = value; + } + + QList getFileDeleteList() const + { + return fileDeleteList; + } + + void setFileDeleteList(const QList &value) + { + fileDeleteList = value; + } + + + private: QString name; QString address; @@ -141,6 +163,10 @@ private: TypeClientAutorization typeClient; UserType userType; QByteArray clientHash; + QList fileSendList; + QList fileDeleteList; }; #endif // CLIENT_H + + diff --git a/ServerLMS/Systems/recognizesystem.cpp b/ServerLMS/Systems/recognizesystem.cpp index cc06b02..09762bb 100644 --- a/ServerLMS/Systems/recognizesystem.cpp +++ b/ServerLMS/Systems/recognizesystem.cpp @@ -108,9 +108,9 @@ void RecognizeSystem::recognize() if (packetType == PacketType::TYPE_UPDATE) { - - sendSystem->updateFiles(updateController->getFileSendList(), - updateController->getFileDeleteList()); + QList sendList = updateController->prepareRealPathList(client->getFileSendList()); + sendSystem->updateFiles(sendList, + client->getFileDeleteList()); qDebug()<< "Call update no docs"; packetType = PacketType::TYPE_NONE; diff --git a/ServerLMS/Systems/sendsystem.cpp b/ServerLMS/Systems/sendsystem.cpp index d31906d..ad8a8c8 100644 --- a/ServerLMS/Systems/sendsystem.cpp +++ b/ServerLMS/Systems/sendsystem.cpp @@ -311,8 +311,6 @@ void SendSystem::updateFiles(QList fileSendList, QList delet return; } } - - //sendPacketType(PacketType::UPDATE_FILES_COMPLETE); sendPacketType(PacketType::UPDATE_FILES_COMPLETE); } @@ -335,7 +333,6 @@ void SendSystem::sendStop() void SendSystem::sendDocs(QString docsPath) { sendFileBlock(docsPath); - //sendPacketType(PacketType::UPDATE_DOCS_COMPLETE); } bool SendSystem::getIsSendStopped() const diff --git a/ServerLMS/Systems/updatecontroller.cpp b/ServerLMS/Systems/updatecontroller.cpp index 21b6330..eaf0521 100644 --- a/ServerLMS/Systems/updatecontroller.cpp +++ b/ServerLMS/Systems/updatecontroller.cpp @@ -241,6 +241,11 @@ QString UpdateController::getCurrentStreamingPath() const return currentStreamingPath; } +QList UpdateController::prepareRealPathList(QList fileData) +{ + return *assetManager->prepareRealPathList(&fileData); +} + void UpdateController::setLocalFileData(QList dataList) { serverDataList.append(dataList); @@ -250,9 +255,8 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler) { QList *forSend = new QList; QList *forDelete = new QList; + Client *client = handler->getClient(); - fileSendList.clear(); - fileDeleteList.clear(); sizeToSend = 0; bool needUpdate = false; @@ -282,45 +286,38 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler) if(forSend->length() > 0) //формирование сообщения об обновлении { QString log; - log.append(" Client: " + handler->getClient()->getLogin()); + log.append(" Client: " + client->getLogin()); log.append(" Need updates: "); log.append(QString::number(forSend->length())); log.append(" objects"); - fileSendList = *forSend; - + client->setFileSendList(*forSend); Logger::instance().log(log); - //printFileList(*forSend); - - //handler->sendMessageBlock(log); needUpdate = true; } else { QString log; - log.append(" Client: " + handler->getClient()->getLogin()); + log.append(" Client: " + client->getLogin()); log.append(" no update required"); Logger::instance().log(log); - //handler->sendMessageBlock(log); } if(forDelete->length() > 0){ QString log; - log.append(" Client: " + handler->getClient()->getLogin()); + log.append(" Client: " + client->getLogin()); log.append(" Need delete: "); log.append(QString::number(forDelete->length())); log.append(" objects"); - fileDeleteList = *forDelete; + client->setFileDeleteList(*forDelete); Logger::instance().log(log); - //printFileList(*forDelete); - //handler->sendMessageBlock(log); needUpdate = true; } else { QString log; - log.append(" Client: " + handler->getClient()->getLogin()); + log.append(" Client: " + client->getLogin()); log.append(" no delete required"); Logger::instance().log(log); @@ -329,6 +326,7 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler) CalculateSizeToSend(*forSend); handler->sendNeedUpdate(needUpdate,sizeToSend,forSend->length(),forDelete->length()); + return needUpdate; } @@ -550,6 +548,8 @@ void UpdateController::xmlFileDataParse(QByteArray array) } } + + StreamingVersionData* UpdateController::getCurrentVersion() { return assetManager->getCurrentVersionData(); @@ -566,18 +566,6 @@ void UpdateController::printFileList(QList fileData) } } -QList UpdateController::getFileDeleteList() const -{ - return fileDeleteList; -} - -QList UpdateController::getFileSendList() -{ - QList *copy = new QList(fileSendList); - QList sendList = *assetManager->prepareRealPathList(copy); - return sendList; -} - QList UpdateController::getClientDataList() const { return clientDataList; diff --git a/ServerLMS/Systems/updatecontroller.h b/ServerLMS/Systems/updatecontroller.h index fba69f5..54c24d7 100644 --- a/ServerLMS/Systems/updatecontroller.h +++ b/ServerLMS/Systems/updatecontroller.h @@ -43,10 +43,9 @@ public: QByteArray getLocalHash(); QString getCurrentVersionName(); - QList getFileSendList(); QList getClientDataList() const; - QList getFileDeleteList() const; QString getCurrentStreamingPath() const; + QList prepareRealPathList(QList fileData); ~UpdateController(); @@ -74,9 +73,6 @@ private: QList clientDataList; QList serverDataList; - QList fileSendList; - QList fileDeleteList; - DataInfo *dataInfo; QString buildPath;