mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
ref: segregate client hashes
This commit is contained in:
@@ -36,7 +36,7 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
|
||||
|
||||
void RecognizeSystem::recognize()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
QMutexLocker locker(mutex);
|
||||
qDebug() << "Recognize thread ID " << QThread::currentThreadId();
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -118,10 +118,7 @@ void RecognizeSystem::recognize()
|
||||
|
||||
if(packetType == PacketType::TYPE_CHECK_VERSION)
|
||||
{
|
||||
QFile checkFile(clientHash);
|
||||
checkFile.open(QIODevice::ReadOnly);
|
||||
updateController->compareFiles(clientHandler,checkFile.readAll());
|
||||
checkFile.close();
|
||||
updateController->compareFiles(clientHandler,client->getClientHash());
|
||||
}
|
||||
|
||||
if (packetType == PacketType::TYPE_XMLANSWER)
|
||||
@@ -454,11 +451,60 @@ void RecognizeSystem::recognize()
|
||||
emit sigSendDocs(updateController->getPathAdditionalFile(tasksAMMfileName));
|
||||
}
|
||||
|
||||
// if(packetType == PacketType::RECALCULATE_HASH)
|
||||
// {
|
||||
// emit sigCalculateHash();
|
||||
// }
|
||||
if (packetType == PacketType::SEND_HASH)
|
||||
{
|
||||
QByteArray hash;
|
||||
|
||||
forever
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> fileSize;
|
||||
|
||||
if(!stream.commitTransaction()) continue;
|
||||
socket->waitForReadyRead(100);
|
||||
break;
|
||||
}
|
||||
|
||||
forever
|
||||
{
|
||||
stream.startTransaction();
|
||||
stream >> tmpBlock;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState){
|
||||
qDebug() << "UNCONNECT";
|
||||
//mutex->unlock();
|
||||
return;
|
||||
}
|
||||
if(socket->waitForReadyRead(100)){
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
hash += tmpBlock;
|
||||
sizeReceiveData += tmpBlock.length();
|
||||
countSend++;
|
||||
|
||||
tmpBlock.clear();
|
||||
|
||||
if(sizeReceiveData == fileSize) break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
QString logMessage = "Load from " + client->getLogin() + " ";
|
||||
|
||||
filePath.clear();
|
||||
fileSize = 0;
|
||||
tmpBlock.clear();
|
||||
sizeReceiveData = 0;
|
||||
countSend = 0;
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
client->setClientHash(hash);
|
||||
}
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,8 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
||||
}
|
||||
}
|
||||
|
||||
sendPacketType(PacketType::TYPE_LOADING_FINISH_WITHOUT_DOCS);
|
||||
//sendPacketType(PacketType::UPDATE_FILES_COMPLETE);
|
||||
sendPacketType(PacketType::UPDATE_FILES_COMPLETE);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +335,7 @@ void SendSystem::sendStop()
|
||||
void SendSystem::sendDocs(QString docsPath)
|
||||
{
|
||||
sendFileBlock(docsPath);
|
||||
sendPacketType(PacketType::TYPE_FULL_LOADING_FINISH);
|
||||
//sendPacketType(PacketType::UPDATE_DOCS_COMPLETE);
|
||||
}
|
||||
|
||||
bool SendSystem::getIsSendStopped() const
|
||||
|
||||
@@ -29,7 +29,7 @@ static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
||||
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
|
||||
static const QString tasksAMMfileName = "/docs.xml"; //"/tasksAmm.xml";
|
||||
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
||||
static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
||||
//static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
||||
static const QString logFolderPath = "log";
|
||||
|
||||
static const QString configFolderName = "config";
|
||||
|
||||
Reference in New Issue
Block a user