mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
bugfix: loading process disable
This commit is contained in:
@@ -11,6 +11,8 @@ void CommonClientHandler::initialize(QMap<int, ClientHandler *> *clientsMap, Pro
|
||||
this->processingSystem = processingSystem;
|
||||
this->dataParser = dataParser;
|
||||
this->logger = logger;
|
||||
|
||||
connect(this,&CommonClientHandler::sigSendToLogger,logger,&Logger::addTextToLogger,Qt::AutoConnection);
|
||||
}
|
||||
|
||||
void CommonClientHandler::sendNewVersionListToAllClient()
|
||||
@@ -85,7 +87,8 @@ void CommonClientHandler::slot_msgToClientFromGUI(QString login, QString text)
|
||||
|
||||
QString str = "Msg To Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||
|
||||
logger->addTextToLogger(str);
|
||||
emit sigSendToLogger(str);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +114,7 @@ void CommonClientHandler::slot_msgToGUIfromClient(QString login, QString text)
|
||||
|
||||
QString str = "Msg From Client [" + peerAddress + ":" + peerPort + "] : " + textMsg;
|
||||
|
||||
logger->addTextToLogger(str);
|
||||
emit sigSendToLogger(str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +137,7 @@ void CommonClientHandler::slot_sendTaskToClient(QString fullNameClient,QString t
|
||||
QString peerPort = QString::number(handler->getSocket()->peerPort());
|
||||
|
||||
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_sendTaskToClient(QString fullNameClient, QString textTask);
|
||||
signals:
|
||||
|
||||
void sigSendToLogger(QString text);
|
||||
private:
|
||||
QMap<int, ClientHandler*> *clientsMap;
|
||||
ProcessingSystem *processingSystem;
|
||||
|
||||
@@ -35,14 +35,22 @@ void SendSystem::sendMessageBlock(QString message)
|
||||
|
||||
void SendSystem::sendFileBlock(QString path)
|
||||
{
|
||||
|
||||
qDebug() << "sendFileBlock thread: " << QThread::currentThreadId();
|
||||
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
if(isSendStopped)
|
||||
{ //Поведение на случай отключения клиента
|
||||
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
fileSize = fileInfo.size();
|
||||
|
||||
if(fileSize == 0){
|
||||
@@ -55,20 +63,19 @@ void SendSystem::sendFileBlock(QString path)
|
||||
|
||||
stream << path << fileSize;
|
||||
|
||||
if(isSendStopped) { //Поведение на случай отключения клиента
|
||||
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
socket->waitForBytesWritten();
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
if(file.open(QFile::ReadOnly)){
|
||||
while(!file.atEnd()){
|
||||
if(file.open(QFile::ReadOnly))
|
||||
{
|
||||
while(!file.atEnd())
|
||||
{
|
||||
QByteArray data = file.read(1025*250);
|
||||
stream << data;
|
||||
socket->waitForBytesWritten();
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState) break;
|
||||
countSend++;
|
||||
}
|
||||
|
||||
@@ -77,7 +84,7 @@ void SendSystem::sendFileBlock(QString path)
|
||||
|
||||
file.close();
|
||||
countSend = 0;
|
||||
socket->waitForBytesWritten();
|
||||
socket->waitForBytesWritten(10);
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
@@ -237,11 +244,9 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
if(getIsSendStopped()) return;
|
||||
if(isSendStopped) return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
emit sigLoadHash();
|
||||
|
||||
sendPacketType(PacketType::TYPE_FINISH);
|
||||
|
||||
@@ -357,57 +357,6 @@ QList<FileData>* UpdateController::calculateHash(QString path)
|
||||
}
|
||||
}
|
||||
serverDataList.append(*files);
|
||||
|
||||
// QDirIterator iterator(path,QDirIterator::Subdirectories);
|
||||
// QDir dir(path);
|
||||
// dir.setFilter(QDir::NoDotAndDotDot);
|
||||
|
||||
// while (iterator.hasNext())
|
||||
// {
|
||||
// iterator.next();
|
||||
// QFileInfo fileInfo = iterator.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.hash = hashString;
|
||||
// currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
|
||||
|
||||
// files->push_back(currentFile);
|
||||
// file.close();
|
||||
|
||||
// }
|
||||
// else if(fileInfo.isDir() && fileInfo.fileName() != ".." && !fileInfo.isRoot())
|
||||
// {
|
||||
// currentFile.hash = "FOLDER";
|
||||
// currentFile.path = Tools::createLocalPath(fileInfo.path());
|
||||
|
||||
// if(!files->contains(currentFile)){
|
||||
// files->push_back(currentFile);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// std::sort(files->begin(),files->end());
|
||||
//
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user