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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user