mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
bugfix: segregate send and delete list to client
This commit is contained in:
@@ -16,6 +16,7 @@ kanban-plugin: board
|
||||
- [ ] Отменить изменения работает некрасиво
|
||||
- [ ] BUSY не меняет иконку блокировки
|
||||
- [ ] не работают ссылки при выгрузке в QT Client
|
||||
- [ ] починить поведение окон при включенном обновлении у 2х пользователей
|
||||
|
||||
|
||||
## feature client Unity
|
||||
|
||||
@@ -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<FileData> getFileSendList() const
|
||||
{
|
||||
return fileSendList;
|
||||
}
|
||||
|
||||
void setFileSendList(const QList<FileData> &value)
|
||||
{
|
||||
fileSendList = value;
|
||||
}
|
||||
|
||||
QList<FileData> getFileDeleteList() const
|
||||
{
|
||||
return fileDeleteList;
|
||||
}
|
||||
|
||||
void setFileDeleteList(const QList<FileData> &value)
|
||||
{
|
||||
fileDeleteList = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QString address;
|
||||
@@ -141,6 +163,10 @@ private:
|
||||
TypeClientAutorization typeClient;
|
||||
UserType userType;
|
||||
QByteArray clientHash;
|
||||
QList<FileData> fileSendList;
|
||||
QList<FileData> fileDeleteList;
|
||||
};
|
||||
|
||||
#endif // CLIENT_H
|
||||
|
||||
|
||||
|
||||
@@ -108,9 +108,9 @@ void RecognizeSystem::recognize()
|
||||
|
||||
if (packetType == PacketType::TYPE_UPDATE)
|
||||
{
|
||||
|
||||
sendSystem->updateFiles(updateController->getFileSendList(),
|
||||
updateController->getFileDeleteList());
|
||||
QList<FileData> sendList = updateController->prepareRealPathList(client->getFileSendList());
|
||||
sendSystem->updateFiles(sendList,
|
||||
client->getFileDeleteList());
|
||||
|
||||
qDebug()<< "Call update no docs";
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
|
||||
@@ -311,8 +311,6 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> 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
|
||||
|
||||
@@ -241,6 +241,11 @@ QString UpdateController::getCurrentStreamingPath() const
|
||||
return currentStreamingPath;
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::prepareRealPathList(QList<FileData> fileData)
|
||||
{
|
||||
return *assetManager->prepareRealPathList(&fileData);
|
||||
}
|
||||
|
||||
void UpdateController::setLocalFileData(QList<FileData> dataList)
|
||||
{
|
||||
serverDataList.append(dataList);
|
||||
@@ -250,9 +255,8 @@ bool UpdateController::checkNeedUpdate(ClientHandler *handler)
|
||||
{
|
||||
QList<FileData> *forSend = new QList<FileData>;
|
||||
QList<FileData> *forDelete = new QList<FileData>;
|
||||
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> fileData)
|
||||
}
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::getFileDeleteList() const
|
||||
{
|
||||
return fileDeleteList;
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::getFileSendList()
|
||||
{
|
||||
QList<FileData> *copy = new QList<FileData>(fileSendList);
|
||||
QList<FileData> sendList = *assetManager->prepareRealPathList(copy);
|
||||
return sendList;
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::getClientDataList() const
|
||||
{
|
||||
return clientDataList;
|
||||
|
||||
@@ -43,10 +43,9 @@ public:
|
||||
QByteArray getLocalHash();
|
||||
|
||||
QString getCurrentVersionName();
|
||||
QList<FileData> getFileSendList();
|
||||
QList<FileData> getClientDataList() const;
|
||||
QList<FileData> getFileDeleteList() const;
|
||||
QString getCurrentStreamingPath() const;
|
||||
QList<FileData> prepareRealPathList(QList<FileData> fileData);
|
||||
|
||||
~UpdateController();
|
||||
|
||||
@@ -74,9 +73,6 @@ private:
|
||||
QList<FileData> clientDataList;
|
||||
QList<FileData> serverDataList;
|
||||
|
||||
QList<FileData> fileSendList;
|
||||
QList<FileData> fileDeleteList;
|
||||
|
||||
DataInfo *dataInfo;
|
||||
|
||||
QString buildPath;
|
||||
|
||||
Reference in New Issue
Block a user