mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Merge branch 'bugfix-updateController' into DEV
This commit is contained in:
@@ -6,12 +6,11 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## backLog
|
## backLog
|
||||||
|
|
||||||
- [ ] выписать все варианты взаимодействия между всеми клиентами и сервером
|
|
||||||
- [ ] sendSystem::sendXmlAnswer новый вариант отпарвки XML пакетов
|
|
||||||
|
|
||||||
|
|
||||||
## bugs
|
## bugs
|
||||||
|
|
||||||
|
- [ ] QT сервер Найти причину двойного вызова проверки при логине инструктором
|
||||||
|
|
||||||
|
|
||||||
## feature client Unity
|
## feature client Unity
|
||||||
@@ -30,18 +29,24 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## feature server
|
## feature server
|
||||||
|
|
||||||
- [ ] Прибраться в Server
|
|
||||||
- [ ] рефакторинг
|
|
||||||
- [ ] добавить генерацию пустых файлов, если shared не найден
|
- [ ] добавить генерацию пустых файлов, если shared не найден
|
||||||
|
- [ ] добавить подключение без DB
|
||||||
|
- [ ] ПЕРЕВЕСТИ все действия под операции и формировать процент из них
|
||||||
|
|
||||||
|
|
||||||
## NOW
|
## NOW
|
||||||
|
|
||||||
- [ ] добавить автоматическое выключение после создания копии
|
|
||||||
|
|
||||||
|
|
||||||
## Complete
|
## Complete
|
||||||
|
|
||||||
|
- [ ] добавить автоматическое выключение после создания копии
|
||||||
|
- [ ] sendSystem::sendXmlAnswer новый вариант отпарвки XML пакетов
|
||||||
|
- [ ] выписать все варианты взаимодействия между всеми клиентами и сервером
|
||||||
|
- [ ] QT клиента: Не показывает блокировка, если версия удаляется
|
||||||
|
- [ ] рефакторинг
|
||||||
|
- [ ] Прибраться в Server
|
||||||
|
- [ ] не работает восстановление файлов
|
||||||
- [ ] запрет на удаление base
|
- [ ] запрет на удаление base
|
||||||
- [ ] None hash
|
- [ ] None hash
|
||||||
- [ ] сверстать окно создания новой версии
|
- [ ] сверстать окно создания новой версии
|
||||||
@@ -265,6 +270,10 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## BUGFIX Complete
|
## BUGFIX Complete
|
||||||
|
|
||||||
|
- [ ] QT клиент: device not open после прерывания загрузки
|
||||||
|
- [ ] QT сервер При изменении версии правильный списке с файлами прилетает со второго раза
|
||||||
|
- [ ] QT клиент, если обновление в режиме инструктора доступно, кнопку запуск отключать
|
||||||
|
- [ ] QT сервер замерзает после выхода пользователя во время скачивания
|
||||||
- [ ] Клиент QT выводить инфу если клиент не подключен
|
- [ ] Клиент QT выводить инфу если клиент не подключен
|
||||||
- [ ] Клиент QT не подключатся повторно, если соединение уже установлено
|
- [ ] Клиент QT не подключатся повторно, если соединение уже установлено
|
||||||
- [ ] Клиент QT Неправильное отображение количества загруженных файлов
|
- [ ] Клиент QT Неправильное отображение количества загруженных файлов
|
||||||
|
|||||||
@@ -30,3 +30,13 @@
|
|||||||
6. Проверка с перезапуском клиента - ХЭШ КОРРЕКТНЫЙ
|
6. Проверка с перезапуском клиента - ХЭШ КОРРЕКТНЫЙ
|
||||||
7. Восстановление версии с сервера на клиент
|
7. Восстановление версии с сервера на клиент
|
||||||
8. Проверка с перезапуском клиента
|
8. Проверка с перезапуском клиента
|
||||||
|
|
||||||
|
Работа с версиями
|
||||||
|
1. QT клиент: Копирование версии
|
||||||
|
2. QT клиент: Копирование версии с указанием существующего имени -> ошибка
|
||||||
|
3. QT клиент: Удаление версии
|
||||||
|
4. QT клиент: Удаление базовой версии -> ошибка
|
||||||
|
5. QT клиент: Удаление версии которая выбрана -> ошибка
|
||||||
|
6. QT клиент: переключении версии
|
||||||
|
7. Unity: отправка в базовую версию
|
||||||
|
8.
|
||||||
@@ -11,6 +11,8 @@ void CommonClientHandler::initialize(QMap<int, ClientHandler *> *clientsMap, Pro
|
|||||||
this->processingSystem = processingSystem;
|
this->processingSystem = processingSystem;
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
this->logger = logger;
|
this->logger = logger;
|
||||||
|
|
||||||
|
connect(this,&CommonClientHandler::sigSendToLogger,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonClientHandler::sendNewVersionListToAllClient()
|
void CommonClientHandler::sendNewVersionListToAllClient()
|
||||||
@@ -85,7 +87,8 @@ void CommonClientHandler::slot_msgToClientFromGUI(QString login, QString text)
|
|||||||
|
|
||||||
QString str = "Msg To Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
QString str = "Msg To Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||||
|
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +114,7 @@ void CommonClientHandler::slot_msgToGUIfromClient(QString login, QString text)
|
|||||||
|
|
||||||
QString str = "Msg From Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
QString str = "Msg From Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||||
|
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +137,7 @@ void CommonClientHandler::slot_sendTaskToClient(QString fullNameClient,QString t
|
|||||||
QString peerPort = QString::number(handler->getSocket()->peerPort());
|
QString peerPort = QString::number(handler->getSocket()->peerPort());
|
||||||
|
|
||||||
QString str = "Task To Client [" + peerAddress + ":" + peerPort + "] : " + textTask;
|
QString str = "Task To Client [" + peerAddress + ":" + peerPort + "] : " + textTask;
|
||||||
logger->addTextToLogger(str);
|
emit sigSendToLogger(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
void slot_msgToGUIfromClient(QString login, QString text);
|
void slot_msgToGUIfromClient(QString login, QString text);
|
||||||
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
|
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
|
||||||
signals:
|
signals:
|
||||||
|
void sigSendToLogger(QString text);
|
||||||
private:
|
private:
|
||||||
QMap<int, ClientHandler*> *clientsMap;
|
QMap<int, ClientHandler*> *clientsMap;
|
||||||
ProcessingSystem *processingSystem;
|
ProcessingSystem *processingSystem;
|
||||||
|
|||||||
@@ -90,13 +90,23 @@ void RecognizeSystem::recognize()
|
|||||||
if (command == commandUpdateFilesClient) //запускает процесс оновления
|
if (command == commandUpdateFilesClient) //запускает процесс оновления
|
||||||
{
|
{
|
||||||
sendSystem->updateFiles(updateController->getFileSendList(),
|
sendSystem->updateFiles(updateController->getFileSendList(),
|
||||||
updateController->getClientDataList());
|
updateController->getFileDeleteList());
|
||||||
|
|
||||||
qDebug()<< "Call update";
|
qDebug()<< "Call update";
|
||||||
packetType = PacketType::TYPE_NONE;
|
packetType = PacketType::TYPE_NONE;
|
||||||
command = "";
|
command = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(command == "check")
|
||||||
|
{
|
||||||
|
command = "";
|
||||||
|
QFile checkFile(clientHash);
|
||||||
|
checkFile.open(QIODevice::ReadOnly);
|
||||||
|
updateController->compareFiles(clientHandler,checkFile.readAll());
|
||||||
|
checkFile.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (packetType == PacketType::TYPE_XMLANSWER)
|
if (packetType == PacketType::TYPE_XMLANSWER)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -280,14 +290,6 @@ void RecognizeSystem::recognize()
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if(command == "check")
|
|
||||||
{
|
|
||||||
QFile checkFile(filePath);
|
|
||||||
checkFile.open(QIODevice::ReadOnly);
|
|
||||||
updateController->compareFiles(clientHandler,checkFile.readAll());
|
|
||||||
checkFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
filePath.clear();
|
filePath.clear();
|
||||||
fileSize = 0;
|
fileSize = 0;
|
||||||
tmpBlock.clear();
|
tmpBlock.clear();
|
||||||
|
|||||||
@@ -35,14 +35,22 @@ void SendSystem::sendMessageBlock(QString message)
|
|||||||
|
|
||||||
void SendSystem::sendFileBlock(QString path)
|
void SendSystem::sendFileBlock(QString path)
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << "sendFileBlock thread: " << QThread::currentThreadId();
|
qDebug() << "sendFileBlock thread: " << QThread::currentThreadId();
|
||||||
|
|
||||||
|
QFile file(path);
|
||||||
|
QFileInfo fileInfo(file);
|
||||||
|
|
||||||
|
if(isSendStopped)
|
||||||
|
{ //Поведение на случай отключения клиента
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
|
|
||||||
QFile file(path);
|
|
||||||
QFileInfo fileInfo(file);
|
|
||||||
fileSize = fileInfo.size();
|
fileSize = fileInfo.size();
|
||||||
|
|
||||||
if(fileSize == 0){
|
if(fileSize == 0){
|
||||||
@@ -55,20 +63,19 @@ void SendSystem::sendFileBlock(QString path)
|
|||||||
|
|
||||||
stream << path << fileSize;
|
stream << path << fileSize;
|
||||||
|
|
||||||
if(isSendStopped) { //Поведение на случай отключения клиента
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
|
|
||||||
if(file.open(QFile::ReadOnly)){
|
if(file.open(QFile::ReadOnly))
|
||||||
while(!file.atEnd()){
|
{
|
||||||
|
while(!file.atEnd())
|
||||||
|
{
|
||||||
QByteArray data = file.read(1025*250);
|
QByteArray data = file.read(1025*250);
|
||||||
stream << data;
|
stream << data;
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
|
|
||||||
|
if(socket->state() == QAbstractSocket::UnconnectedState) break;
|
||||||
countSend++;
|
countSend++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +84,7 @@ void SendSystem::sendFileBlock(QString path)
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
countSend = 0;
|
countSend = 0;
|
||||||
socket->waitForBytesWritten();
|
socket->waitForBytesWritten(10);
|
||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,11 +244,9 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
|||||||
socket->waitForReadyRead(100);
|
socket->waitForReadyRead(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getIsSendStopped()) return;
|
if(isSendStopped) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
emit sigLoadHash();
|
emit sigLoadHash();
|
||||||
|
|
||||||
sendPacketType(PacketType::TYPE_FINISH);
|
sendPacketType(PacketType::TYPE_FINISH);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ static const QString versionListFile = staticDataFolderName + "/versionList.xml"
|
|||||||
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
|
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
|
||||||
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
||||||
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
|
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
|
||||||
|
static const QString clientHash = staticDataFolderName + "/clientHash.xml";
|
||||||
|
|
||||||
static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?
|
static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ void UpdateController::createCopyVersion(QString versionName,QString newVersionN
|
|||||||
|
|
||||||
void UpdateController::deleteAssetVersion(QString versionName)
|
void UpdateController::deleteAssetVersion(QString versionName)
|
||||||
{
|
{
|
||||||
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
||||||
assetManager->deleteVersion(versionName);
|
assetManager->deleteVersion(versionName);
|
||||||
|
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
||||||
@@ -59,7 +61,6 @@ void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
|||||||
loadHash();
|
loadHash();
|
||||||
clientDataList.clear();
|
clientDataList.clear();
|
||||||
xmlFileDataParse(array);
|
xmlFileDataParse(array);
|
||||||
clientDataList.append(*datas);
|
|
||||||
checkNeedUpdate(handler);
|
checkNeedUpdate(handler);
|
||||||
mutex->unlock();
|
mutex->unlock();
|
||||||
}
|
}
|
||||||
@@ -182,8 +183,6 @@ QString UpdateController::getCommands()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateController::setUpCurrentServerHash()
|
void UpdateController::setUpCurrentServerHash()
|
||||||
{
|
{
|
||||||
QList<FileData> *fileList = new QList<FileData>;
|
QList<FileData> *fileList = new QList<FileData>;
|
||||||
@@ -296,61 +295,69 @@ QList<FileData>* UpdateController::calculateHash(QString path)
|
|||||||
{
|
{
|
||||||
serverDataList.clear();
|
serverDataList.clear();
|
||||||
|
|
||||||
QDirIterator iterator(path,QDirIterator::Subdirectories);
|
|
||||||
if(!QDir(path).exists()){
|
if(!QDir(path).exists()){
|
||||||
QDir().mkdir(path);
|
QDir().mkdir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(path);
|
|
||||||
dir.setFilter(QDir::NoDotAndDotDot);
|
|
||||||
QString hashString;
|
QString hashString;
|
||||||
|
QStringList filter;
|
||||||
|
filter << "*";
|
||||||
QList<FileData> *files = new QList<FileData>;
|
QList<FileData> *files = new QList<FileData>;
|
||||||
|
|
||||||
while (iterator.hasNext())
|
QDirIterator dirIterator(path,filter, QDir::AllEntries | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (dirIterator.hasNext())
|
||||||
{
|
{
|
||||||
iterator.next();
|
QFileInfo fileInfo(dirIterator.next());
|
||||||
QFileInfo fileInfo = iterator.fileInfo();
|
|
||||||
FileData currentFile;
|
FileData currentFile;
|
||||||
QFile file(fileInfo.absoluteFilePath());
|
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
|
||||||
|
|
||||||
quint64 fileSize = file.size();
|
|
||||||
const quint64 bufferSize = 10240;
|
|
||||||
|
|
||||||
if (fileInfo.isHidden()) continue;
|
|
||||||
|
|
||||||
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly) && !fileInfo.fileName().contains(".meta"))
|
|
||||||
{
|
{
|
||||||
char buffer[bufferSize];
|
|
||||||
int bytesRead;
|
|
||||||
int readSize = qMin(fileSize,bufferSize);
|
|
||||||
|
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
|
||||||
while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0){
|
|
||||||
fileSize -= bytesRead;
|
|
||||||
hash.addData(buffer,bytesRead);
|
|
||||||
readSize = qMin(fileSize,bufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
hashString = QString(hash.result().toHex());
|
|
||||||
currentFile.hash = hashString;
|
|
||||||
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
files->push_back(currentFile);
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(fileInfo.isDir() && fileInfo.fileName() != ".." && !fileInfo.isRoot())
|
|
||||||
{
|
|
||||||
currentFile.hash = "FOLDER";
|
currentFile.hash = "FOLDER";
|
||||||
currentFile.path = Tools::createLocalPath(fileInfo.path());
|
|
||||||
|
|
||||||
if(!files->contains(currentFile)){
|
if(!files->contains(currentFile))
|
||||||
|
{
|
||||||
files->push_back(currentFile);
|
files->push_back(currentFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(files->begin(),files->end());
|
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
|
||||||
|
|
||||||
|
while (fileIterator.hasNext())
|
||||||
|
{
|
||||||
|
fileIterator.next();
|
||||||
|
QFileInfo fileInfo = fileIterator.fileInfo();
|
||||||
|
FileData currentFile;
|
||||||
|
QFile file(fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
|
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||||
|
const quint64 bufferSize = 10240;
|
||||||
|
|
||||||
|
if(fileInfo.isHidden()) continue;
|
||||||
|
|
||||||
|
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly) && !fileInfo.fileName().contains(".meta"))
|
||||||
|
{
|
||||||
|
char buffer[bufferSize];
|
||||||
|
int bytesRead;
|
||||||
|
int readSize = qMin(fileSize,bufferSize);
|
||||||
|
|
||||||
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
|
|
||||||
|
while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0)
|
||||||
|
{
|
||||||
|
fileSize -= bytesRead;
|
||||||
|
hash.addData(buffer,bytesRead);
|
||||||
|
readSize = qMin(fileSize,bufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
hashString = QString(hash.result().toHex());
|
||||||
|
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||||
|
currentFile.hash = hashString;
|
||||||
|
files->push_back(currentFile);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
serverDataList.append(*files);
|
serverDataList.append(*files);
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
@@ -398,6 +405,12 @@ void UpdateController::CalculateSizeToSend(QList<FileData> diffList)
|
|||||||
void UpdateController::calculateSharedHash()
|
void UpdateController::calculateSharedHash()
|
||||||
{
|
{
|
||||||
QDir sharedDir(sharedDataPath);
|
QDir sharedDir(sharedDataPath);
|
||||||
|
|
||||||
|
if(!QDir(sharedDataPath).exists())
|
||||||
|
{
|
||||||
|
QDir().mkdir(sharedDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
QDirIterator dirIterator(sharedDir);
|
QDirIterator dirIterator(sharedDir);
|
||||||
QList<FileData> *fileList = new QList<FileData>;
|
QList<FileData> *fileList = new QList<FileData>;
|
||||||
QList<StreamingVersionData*> *versionList = new QList<StreamingVersionData*>;
|
QList<StreamingVersionData*> *versionList = new QList<StreamingVersionData*>;
|
||||||
@@ -499,7 +512,6 @@ bool UpdateController::checkDuplicate(QString versionName)
|
|||||||
void UpdateController::xmlFileDataParse(QByteArray array)
|
void UpdateController::xmlFileDataParse(QByteArray array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
datas = new QList<FileData>;
|
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|
||||||
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
//Крутимся в цикле до тех пор, пока не достигнем конца документа
|
||||||
@@ -523,7 +535,7 @@ void UpdateController::xmlFileDataParse(QByteArray array)
|
|||||||
data.hash = value;
|
data.hash = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
datas->append(data);
|
clientDataList.append(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,11 +577,6 @@ DataInfo *UpdateController::getCurrentDataInfo()
|
|||||||
return dataInfo;
|
return dataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FileData> *UpdateController::getDatas() const
|
|
||||||
{
|
|
||||||
return datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateController::clearCurrentDataInfo()
|
void UpdateController::clearCurrentDataInfo()
|
||||||
{
|
{
|
||||||
delete dataInfo;
|
delete dataInfo;
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ public:
|
|||||||
|
|
||||||
DataInfo *getCurrentDataInfo();
|
DataInfo *getCurrentDataInfo();
|
||||||
void clearCurrentDataInfo();
|
void clearCurrentDataInfo();
|
||||||
QList<FileData> *getDatas() const;
|
|
||||||
void createVersionListXmlAnswer(QList<StreamingVersionData *> version);
|
void createVersionListXmlAnswer(QList<StreamingVersionData *> version);
|
||||||
void saveVersionToFile(StreamingVersionData *streamingVersion);
|
void saveVersionToFile(StreamingVersionData *streamingVersion);
|
||||||
void xmlFileDataParse(QByteArray array);
|
void xmlFileDataParse(QByteArray array);
|
||||||
@@ -71,7 +70,6 @@ private:
|
|||||||
QList<FileData> fileSendList;
|
QList<FileData> fileSendList;
|
||||||
QList<FileData> fileDeleteList;
|
QList<FileData> fileDeleteList;
|
||||||
|
|
||||||
QList<FileData> *datas;
|
|
||||||
DataInfo *dataInfo;
|
DataInfo *dataInfo;
|
||||||
|
|
||||||
QString buildPath;
|
QString buildPath;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
|
|||||||
connect(this,&ClientHandler::sigSocketClose,sendSystem,&SendSystem::socketClose,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSocketClose,sendSystem,&SendSystem::socketClose,Qt::AutoConnection);
|
||||||
connect(this,&ClientHandler::sigSocketFlush,sendSystem,&SendSystem::socketFlush,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSocketFlush,sendSystem,&SendSystem::socketFlush,Qt::AutoConnection);
|
||||||
connect(this,&ClientHandler::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
connect(this,&ClientHandler::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
|
||||||
|
connect(this,&ClientHandler::sigSendStop,sendSystem,&SendSystem::sendStop,Qt::DirectConnection);
|
||||||
|
|
||||||
connect(socket,&QTcpSocket::readyRead,recognizeSystem,&RecognizeSystem::recognize,Qt::AutoConnection);
|
connect(socket,&QTcpSocket::readyRead,recognizeSystem,&RecognizeSystem::recognize,Qt::AutoConnection);
|
||||||
connect(socket, &QTcpSocket::disconnected, this, &ClientHandler::sendDisable,Qt::AutoConnection);
|
connect(socket, &QTcpSocket::disconnected, this, &ClientHandler::sendDisable,Qt::AutoConnection);
|
||||||
@@ -129,8 +130,10 @@ void ClientHandler::sendNeedUpdate(bool flag, quint64 size, quint64 fileCount,qu
|
|||||||
|
|
||||||
void ClientHandler::sendDisable()
|
void ClientHandler::sendDisable()
|
||||||
{
|
{
|
||||||
thread->exit();
|
// thread->exit();
|
||||||
thread->wait();
|
// thread->wait();
|
||||||
|
thread->quit();
|
||||||
|
emit sigSendStop();
|
||||||
emit sigClientDisconnected(client->getAddress(),client->getPort());
|
emit sigClientDisconnected(client->getAddress(),client->getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ signals:
|
|||||||
bool sigSocketFlush();
|
bool sigSocketFlush();
|
||||||
void sigSendVersion();
|
void sigSendVersion();
|
||||||
void sigSendPacketType(PacketType packetType);
|
void sigSendPacketType(PacketType packetType);
|
||||||
|
void sigSendStop();
|
||||||
|
|
||||||
public :
|
public :
|
||||||
QThread *thread;
|
QThread *thread;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ MultiThreadServer::MultiThreadServer(ServerLMSWidget *widget,UpdateController *u
|
|||||||
dataParser(dataParser),
|
dataParser(dataParser),
|
||||||
logger(logger)
|
logger(logger)
|
||||||
{
|
{
|
||||||
|
connect(this,&MultiThreadServer::sigSendToLogger,logger,&Logger::addTextToLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
||||||
@@ -16,14 +16,14 @@ void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
|||||||
ClientHandler* newClient = new ClientHandler;
|
ClientHandler* newClient = new ClientHandler;
|
||||||
|
|
||||||
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
|
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
|
||||||
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::QueuedConnection);
|
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection);
|
||||||
|
|
||||||
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser,logger);
|
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser,logger);
|
||||||
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
|
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
|
||||||
|
|
||||||
serverLmsWidget->addClient(socketDesriptor,newClient);
|
serverLmsWidget->addClient(socketDesriptor,newClient);
|
||||||
|
|
||||||
logger->addTextToLogger("To Client: " + QString(SERVER_HELLO));
|
emit sigSendToLogger("To Client: " + QString(SERVER_HELLO));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPort)
|
void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPort)
|
||||||
@@ -53,8 +53,7 @@ void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit signalStopSendFile();
|
emit signalStopSendFile();
|
||||||
|
emit sigSendToLogger("SERVER: Client " + login + " disconnected");
|
||||||
logger->addTextToLogger("SERVER: Client " + login + " disconnected");
|
|
||||||
|
|
||||||
serverLmsWidget->slotUpdateListClients();
|
serverLmsWidget->slotUpdateListClients();
|
||||||
serverLmsWidget->autorizationHandler(login);
|
serverLmsWidget->autorizationHandler(login);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ signals:
|
|||||||
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
|
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
|
||||||
UpdateController *updateController, DataParser *dataParser,Logger *logger);
|
UpdateController *updateController, DataParser *dataParser,Logger *logger);
|
||||||
void signalStopSendFile();
|
void signalStopSendFile();
|
||||||
|
void sigSendToLogger(QString text);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
void slotDisconnectClient(QString peerAddress, QString peerPort);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
tcpServer(nullptr),
|
tcpServer(nullptr),
|
||||||
hostPort(6000),
|
hostPort(6000),
|
||||||
stateServer(stoped),
|
stateServer(stoped),
|
||||||
stateBlockAutorization(blocked),
|
stateBlockAutorization(unblocked),
|
||||||
updateThread(nullptr),
|
updateThread(nullptr),
|
||||||
loggerThread(nullptr),
|
loggerThread(nullptr),
|
||||||
dataParser(nullptr),
|
dataParser(nullptr),
|
||||||
@@ -44,11 +44,13 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
loggerThread = new QThread;
|
loggerThread = new QThread;
|
||||||
|
|
||||||
providerDBLMS = new ProviderDBLMS(this);
|
providerDBLMS = new ProviderDBLMS(this);
|
||||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
|
||||||
providerDBLMS->ConnectionToDB();
|
providerDBLMS->ConnectionToDB();
|
||||||
|
|
||||||
logger = new Logger(ui->listWidgetLogger);
|
logger = new Logger(ui->listWidgetLogger);
|
||||||
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::QueuedConnection);
|
|
||||||
|
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
||||||
|
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::AutoConnection);
|
||||||
|
|
||||||
logger->moveToThread(loggerThread);
|
logger->moveToThread(loggerThread);
|
||||||
|
|
||||||
assetsManager = new AssetsManager;
|
assetsManager = new AssetsManager;
|
||||||
@@ -194,7 +196,7 @@ void ServerLMSWidget::slotUpdateListClients()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int countClients = clientsMap.count();
|
int countClients = clientsMap.count();
|
||||||
logger->addTextToLogger("SERVER: countClients = " + QString::number(countClients));
|
emit sigLog("SERVER: countClients = " + QString::number(countClients));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||||
|
|||||||
Reference in New Issue
Block a user