mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Merge branch 'work48' into DEV
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "recognizesystem.h"
|
||||
|
||||
RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
globalMutex(nullptr)
|
||||
{
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
filePath.clear();
|
||||
@@ -13,7 +14,7 @@ QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
void RecognizeSystem::initialize(UpdateController *updateController,DataParser* dataParser,SendSystem *sendSystem, ClientHandler *handler)
|
||||
void RecognizeSystem::initialize(UpdateController *updateController,DataParser* dataParser, QMutex *globalMutex,SendSystem *sendSystem, ClientHandler *handler)
|
||||
{
|
||||
qDebug() << "RecognizeSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
@@ -22,6 +23,7 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
|
||||
this->clientHandler = handler;
|
||||
this->sendSystem = sendSystem;
|
||||
socket = handler->getSocket();
|
||||
this->globalMutex = globalMutex;
|
||||
|
||||
connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::calculateFullHashWithSetup,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigChangeVersion,updateController,&UpdateController::changeAssetVersion,Qt::AutoConnection);
|
||||
@@ -453,6 +455,7 @@ void RecognizeSystem::recognize()
|
||||
if(packetType == PacketType::GET_DOCS)
|
||||
{
|
||||
emit sigSendDocs(updateController->getPathAdditionalFile(tasksAMMfileName));
|
||||
//globalMutex->unlock();
|
||||
}
|
||||
|
||||
if (packetType == PacketType::SEND_HASH)
|
||||
|
||||
@@ -22,7 +22,7 @@ class RecognizeSystem : public QObject
|
||||
|
||||
public:
|
||||
RecognizeSystem(QObject *parent = nullptr);
|
||||
void initialize(UpdateController *updateController,DataParser *dataParser, SendSystem *sendSystem, ClientHandler *handler);
|
||||
void initialize(UpdateController *updateController,DataParser *dataParser, QMutex *globalMutex, SendSystem *sendSystem, ClientHandler *handler);
|
||||
void recognize();
|
||||
~RecognizeSystem();
|
||||
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
QString filePath;
|
||||
ClientHandler *clientHandler;
|
||||
QMutex *mutex;
|
||||
QMutex *globalMutex;
|
||||
|
||||
QTcpSocket *socket;
|
||||
|
||||
|
||||
@@ -2,26 +2,53 @@
|
||||
|
||||
SendSystem::SendSystem(QObject *parent) : QObject(parent)
|
||||
{
|
||||
isSendStopped = false;
|
||||
qDebug() << "SendSystem init thread ID " << QThread::currentThreadId();
|
||||
|
||||
client = nullptr;
|
||||
socket = nullptr;
|
||||
dataParser = nullptr;
|
||||
|
||||
globalMutex = nullptr;
|
||||
waitCondition = nullptr;
|
||||
|
||||
buffer = nullptr;
|
||||
|
||||
type = TypeClientAutorization::TYPE_GUI;
|
||||
|
||||
isSendStopped = false;
|
||||
flWaitWriten = false;
|
||||
|
||||
fileSize = 0;
|
||||
countSend = 0;
|
||||
|
||||
buffer = new char[sendFileBlockSize];
|
||||
}
|
||||
|
||||
SendSystem::~SendSystem()
|
||||
{
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
|
||||
void SendSystem::initialize(DataParser *dataParser,QMutex *globalMutex)
|
||||
{
|
||||
qDebug() << "SendSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->dataParser = dataParser;
|
||||
//connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection); //сигнал не используется
|
||||
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
|
||||
//connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection); //сигнал не используется
|
||||
this->globalMutex = globalMutex;
|
||||
|
||||
mutex = globalMutex;
|
||||
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
|
||||
}
|
||||
|
||||
void SendSystem::setClient(Client *client,QTcpSocket *socket)
|
||||
{
|
||||
this->socket = socket;
|
||||
this->type = client->getClientType();
|
||||
qDebug() << "SendSystem::setClient thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->socket = socket;
|
||||
this->client = client;
|
||||
|
||||
this->type = client->getClientType();
|
||||
|
||||
isSendStopped = false;
|
||||
}
|
||||
|
||||
@@ -35,50 +62,239 @@ void SendSystem::sendNotify(QString notify)
|
||||
|
||||
void SendSystem::sendFileBlock(QString path)
|
||||
{
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
//qDebug() << "SendSystem::sendFileBlock path: " << path;
|
||||
|
||||
if(isSendStopped)
|
||||
if(getIsSendStopped())
|
||||
{ //Поведение на случай отключения клиента
|
||||
file.close();
|
||||
Logger::instance().log("UNLOCK STOP MUTEX : " + client->getLogin(),LogLevel::ERROR);
|
||||
Logger::instance().log("Client: " + client->getLogin() + " isSendStopped", LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
fileSize = file.size();
|
||||
|
||||
if (fileSize == 0)
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " WARNING! Zero size " + fileInfo.fileName(),LogLevel::ERROR);
|
||||
Logger::instance().log(path,LogLevel::ERROR);
|
||||
Logger::instance().log("Client: " + client->getLogin() + " ERROR! File zero size " + fileInfo.fileName(), LogLevel::ERROR);
|
||||
Logger::instance().log(path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!file.open(QFile::ReadOnly))
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " ERROR! File not open: " + fileInfo.fileName(), LogLevel::ERROR);
|
||||
Logger::instance().log(path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
countSend = 0;
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
stream << PacketType::TYPE_FILE; //Отправляем тип блока
|
||||
stream << path << fileSize;
|
||||
|
||||
if(file.open(QFile::ReadOnly))
|
||||
{
|
||||
while(!file.atEnd())
|
||||
{
|
||||
QByteArray data = file.read(sendFileBlockSize);
|
||||
stream << data;
|
||||
//socket->waitForBytesWritten(10);
|
||||
waitWrittenData("sendFileBlock:header " + fileInfo.fileName());
|
||||
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState) break;
|
||||
countSend++;
|
||||
while(!file.atEnd())
|
||||
{
|
||||
QByteArray data = file.read(sendFileBlockSize);
|
||||
stream << data;
|
||||
|
||||
waitWrittenData(QString("sendFileBlock:data (size %1) ").arg(data.size()) + fileInfo.fileName());
|
||||
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState)
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " UnconnectedState", LogLevel::ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
//emit sigSendToLogger(Tools::getTime() + " send file " + fileInfo.fileName());
|
||||
countSend++;
|
||||
}
|
||||
|
||||
file.close();
|
||||
countSend = 0;
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlock_V2(QString path)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
Logger::instance().log("ERROR open file: " + path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
countSend = 0;
|
||||
fileSize = file.size();
|
||||
|
||||
if (fileSize == 0)
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " WARNING! Zero size " +file.fileName(), LogLevel::ERROR);
|
||||
Logger::instance().log(path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
QString type = QString::number(PacketType::TYPE_FILE);
|
||||
QString fileSizeStr = QString::number(fileSize);
|
||||
|
||||
qDebug() << "SendSystem::sendFileBlock_V2 file " << file.fileName() << " size " << fileSizeStr;
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
|
||||
|
||||
//mutexWriten.lock();
|
||||
//flWaitWriten = true;
|
||||
|
||||
stream << PacketType::TYPE_FILE; //Отправляем тип блока
|
||||
stream << path << fileSize;
|
||||
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
/*
|
||||
while(flWaitWriten)
|
||||
{
|
||||
QCoreApplication::processEvents(); // Обеспечиваем обработку сообщений
|
||||
}
|
||||
*/
|
||||
//socket->waitForBytesWritten(10);
|
||||
|
||||
//socket->write(type.toUtf8());
|
||||
//socket->write(fileSizeStr.toUtf8());
|
||||
|
||||
connect(this->socket, &QTcpSocket::bytesWritten, this, &SendSystem::slot_BytesWrittenToSocket);
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState)
|
||||
break;
|
||||
|
||||
countSend++;
|
||||
|
||||
qint64 readBytes = file.read(buffer, /*sizeof(buffer)*/sendFileBlockSize);
|
||||
if(readBytes <= 0)
|
||||
break;
|
||||
|
||||
flWaitWriten = true;
|
||||
while(!socket->write(buffer, readBytes))
|
||||
{
|
||||
int i = 0;
|
||||
i++;
|
||||
}
|
||||
while(flWaitWriten)
|
||||
{
|
||||
QCoreApplication::processEvents(); // Обеспечиваем обработку сообщений
|
||||
}
|
||||
/*
|
||||
while(!socket->flush())
|
||||
{
|
||||
int i = 0;
|
||||
i++;
|
||||
}
|
||||
*/
|
||||
// Завершаем отправку
|
||||
//socket->flush();
|
||||
//socket->waitForBytesWritten(10);
|
||||
}
|
||||
|
||||
disconnect(this->socket, &QTcpSocket::bytesWritten, this, &SendSystem::slot_BytesWrittenToSocket);
|
||||
|
||||
//socket->flush();
|
||||
/*
|
||||
while(!socket->flush())
|
||||
{
|
||||
int i = 0;
|
||||
i++;
|
||||
}*/
|
||||
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlock_V3(QString path)
|
||||
{
|
||||
//qDebug() << "SendSystem::sendFileBlock path: " << path;
|
||||
|
||||
if(getIsSendStopped())
|
||||
{ //Поведение на случай отключения клиента
|
||||
Logger::instance().log("Client: " + client->getLogin() + " isSendStopped", LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(path);
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
fileSize = file.size();
|
||||
|
||||
if (fileSize == 0)
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " ERROR! File zero size " + fileInfo.fileName(), LogLevel::ERROR);
|
||||
Logger::instance().log(path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!file.open(QFile::ReadOnly))
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " ERROR! File not open: " + fileInfo.fileName(), LogLevel::ERROR);
|
||||
Logger::instance().log(path, LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
countSend = 0;
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
stream << PacketType::TYPE_FILE; //Отправляем тип блока
|
||||
stream << path << fileSize;
|
||||
|
||||
waitWrittenData("sendFileBlock:header " + fileInfo.fileName());
|
||||
|
||||
connect(this->socket, &QTcpSocket::bytesWritten, this, &SendSystem::slot_BytesWrittenToSocket);
|
||||
|
||||
while(!file.atEnd())
|
||||
{
|
||||
if(socket->state() == QAbstractSocket::UnconnectedState)
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " UnconnectedState", LogLevel::ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
qint64 readBytes = file.read(buffer, /*sizeof(buffer)*/sendFileBlockSize);
|
||||
if(readBytes <= 0)
|
||||
break;
|
||||
|
||||
flWaitWriten = true;
|
||||
while(!socket->write(buffer, readBytes))
|
||||
{
|
||||
int i = 0;
|
||||
i++;
|
||||
qCritical() << "socket->write ERROR. size " + QString::number(readBytes);
|
||||
}
|
||||
while(flWaitWriten)
|
||||
{
|
||||
QCoreApplication::processEvents(); // Обеспечиваем обработку сообщений
|
||||
int i = 0;
|
||||
i++;
|
||||
}
|
||||
|
||||
waitWrittenData(QString("sendFileBlock:data (readBytes %1, num %2) ").arg(QString::number(readBytes), QString::number(countSend)) + fileInfo.fileName());
|
||||
|
||||
countSend++;
|
||||
}
|
||||
|
||||
disconnect(this->socket, &QTcpSocket::bytesWritten, this, &SendSystem::slot_BytesWrittenToSocket);
|
||||
|
||||
file.close();
|
||||
countSend = 0;
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||
{
|
||||
if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
|
||||
@@ -99,11 +315,15 @@ void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||
stream << packetType; //Отправляем тип блока
|
||||
stream << size;
|
||||
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
while (bytesSended < size)
|
||||
{
|
||||
QByteArray chunk = array.mid(bytesSended,sendFileBlockSize);
|
||||
stream << chunk;
|
||||
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
bytesSended += chunk.length();
|
||||
}
|
||||
}
|
||||
@@ -140,6 +360,11 @@ void SendSystem::sendVersion()
|
||||
sendXmlAnswer(data);
|
||||
}
|
||||
|
||||
void SendSystem::slot_BytesWrittenToSocket(qint64 bytes)
|
||||
{
|
||||
flWaitWriten = false;
|
||||
}
|
||||
|
||||
void SendSystem::sendFileBlockWithRename(QString path, QString newName)
|
||||
{
|
||||
qDebug() << "SendSystem::sendFileBlockWithRename thread ID " << QThread::currentThreadId();
|
||||
@@ -162,6 +387,8 @@ void SendSystem::sendFileBlockWithRename(QString path, QString newName)
|
||||
|
||||
stream << pathForSend << fileSize;
|
||||
|
||||
socket->waitForBytesWritten(10);
|
||||
|
||||
if(isSendStopped) { //Поведение на случай отключения клиента
|
||||
|
||||
file.close();
|
||||
@@ -169,13 +396,13 @@ void SendSystem::sendFileBlockWithRename(QString path, QString newName)
|
||||
}
|
||||
|
||||
|
||||
socket->waitForBytesWritten();
|
||||
//socket->waitForBytesWritten();
|
||||
|
||||
if(file.open(QFile::ReadOnly)){
|
||||
while(!file.atEnd()){
|
||||
QByteArray data = file.read(sendFileBlockSize);
|
||||
stream << data;
|
||||
socket->waitForBytesWritten();
|
||||
socket->waitForBytesWritten(10);
|
||||
countSend++;
|
||||
}
|
||||
|
||||
@@ -184,8 +411,8 @@ void SendSystem::sendFileBlockWithRename(QString path, QString newName)
|
||||
|
||||
file.close();
|
||||
countSend = 0;
|
||||
socket->waitForBytesWritten();
|
||||
socket->waitForReadyRead(100);
|
||||
socket->waitForBytesWritten(10);
|
||||
//socket->waitForReadyRead(100);
|
||||
|
||||
sendNotify(commandHashCompleteClient);
|
||||
}
|
||||
@@ -197,6 +424,8 @@ void SendSystem::sendFolderBlock(QString path)
|
||||
|
||||
stream << PacketType::TYPE_FOLDER;
|
||||
stream << path;
|
||||
|
||||
waitWrittenData("sendFolderBlock");
|
||||
}
|
||||
|
||||
void SendSystem::sendDeleteBlock(QString path)
|
||||
@@ -206,8 +435,8 @@ void SendSystem::sendDeleteBlock(QString path)
|
||||
|
||||
stream << PacketType::TYPE_DELETE;
|
||||
stream << path;
|
||||
qDebug() << "DELETE: " + path;
|
||||
socket->waitForReadyRead(10);
|
||||
|
||||
waitWrittenData("sendDeleteBlock");
|
||||
}
|
||||
|
||||
void SendSystem::sendPacketType(PacketType packetType)
|
||||
@@ -216,11 +445,11 @@ void SendSystem::sendPacketType(PacketType packetType)
|
||||
if (client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
|
||||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
|
||||
{
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
stream << packetType;
|
||||
socket->waitForReadyRead(100);
|
||||
|
||||
waitWrittenData("sendPacketType");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -247,7 +476,8 @@ void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
|
||||
|
||||
stream << packetType;
|
||||
stream << array;
|
||||
socket->waitForBytesWritten();
|
||||
|
||||
waitWrittenData("sendXmlAnswer");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,11 +499,14 @@ void SendSystem::sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64
|
||||
stream << size;
|
||||
stream << fileCount;
|
||||
stream << deleteCount;
|
||||
|
||||
waitWrittenData("sendNeedUpdate");
|
||||
}
|
||||
|
||||
void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList){
|
||||
void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList)
|
||||
{
|
||||
//globalMutex->lock();
|
||||
|
||||
QMutexLocker locker(mutex);
|
||||
QListIterator<FileData> clientIterator(deleteList);
|
||||
|
||||
while(clientIterator.hasNext())
|
||||
@@ -283,6 +516,8 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
||||
sendDeleteBlock(data.path);
|
||||
if(getIsSendStopped())
|
||||
{
|
||||
Logger::instance().log("Client: " + client->getLogin() + " isSendStopped", LogLevel::ERROR);
|
||||
//globalMutex->unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -296,20 +531,22 @@ void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> delet
|
||||
if (data.hash == "FOLDER")
|
||||
{
|
||||
sendFolderBlock(data.path);
|
||||
socket->waitForBytesWritten();
|
||||
}
|
||||
else
|
||||
{
|
||||
sendFileBlock(data.path);
|
||||
socket->waitForBytesWritten();
|
||||
sendFileBlock_V3(data.path);
|
||||
}
|
||||
|
||||
if(isSendStopped)
|
||||
if(getIsSendStopped())
|
||||
{
|
||||
//globalMutex->unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sendPacketType(PacketType::UPDATE_FILES_COMPLETE);
|
||||
|
||||
//globalMutex->unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +575,17 @@ bool SendSystem::getIsSendStopped() const
|
||||
return isSendStopped;
|
||||
}
|
||||
|
||||
SendSystem::~SendSystem()
|
||||
bool SendSystem::waitWrittenData(QString marker, int msec)
|
||||
{
|
||||
|
||||
bool success = socket->waitForBytesWritten(msec);
|
||||
if(success)
|
||||
{
|
||||
//qInfo() << "Data sended OK. <" + marker + ">";
|
||||
}
|
||||
else
|
||||
{
|
||||
qCritical() << "Data sended ERROR. <" + marker + ">";
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,15 @@ class SendSystem : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SendSystem(QObject* parent = nullptr);
|
||||
~SendSystem();
|
||||
|
||||
void initialize(DataParser* dataParser,QMutex *globalMutex);
|
||||
void setClient(Client* client,QTcpSocket *socket);
|
||||
|
||||
void sendMessageBlock(QString message);
|
||||
void sendFileBlock(QString path);
|
||||
void sendFileBlock_V2(QString path);
|
||||
void sendFileBlock_V3(QString path);
|
||||
void sendFileBlockByteArray(QByteArray array, PacketType packetType);
|
||||
void sendFileBlockWithRename(QString path,QString newName);
|
||||
void sendFolderBlock(QString path);
|
||||
@@ -35,18 +39,21 @@ public:
|
||||
void sendDocs(QString docPath);
|
||||
void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
|
||||
void sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
|
||||
|
||||
void updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList);
|
||||
|
||||
bool getIsSendStopped() const;
|
||||
|
||||
~SendSystem();
|
||||
|
||||
|
||||
void updateFilesFULL(QList<FileData> fileSendList, QList<FileData> deleteList);
|
||||
|
||||
bool waitWrittenData(QString marker, int msec = 500);
|
||||
|
||||
public slots:
|
||||
void socketClose();
|
||||
void sendVersion();
|
||||
|
||||
void slot_BytesWrittenToSocket(qint64 bytes);
|
||||
|
||||
signals:
|
||||
void sigLoadHash();
|
||||
//QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text, QString userType); //сигнал не используется
|
||||
@@ -57,12 +64,19 @@ private:
|
||||
Client *client;
|
||||
QTcpSocket* socket;
|
||||
DataParser* dataParser;
|
||||
quint64 fileSize;
|
||||
QMutex *mutex;
|
||||
|
||||
QMutex *globalMutex;
|
||||
QWaitCondition *waitCondition;
|
||||
int countSend;
|
||||
bool isSendStopped;
|
||||
|
||||
char* buffer;
|
||||
|
||||
TypeClientAutorization type;
|
||||
|
||||
bool isSendStopped;
|
||||
bool flWaitWriten;
|
||||
|
||||
quint64 fileSize;
|
||||
int countSend;
|
||||
};
|
||||
|
||||
#endif // SENDSYSTEM_H
|
||||
|
||||
@@ -58,7 +58,8 @@ static const QString commandeGetOfflineMessages = "GETOFFLINEMESSAGE";
|
||||
static const QString commandGetCFI = "GETCFI";
|
||||
|
||||
//static quint64 fileBlockSize = 1460;
|
||||
static quint64 sendFileBlockSize = 256000;
|
||||
const int BLOCK_SIZE = 1024 * 1024; // Размер блока
|
||||
static quint64 sendFileBlockSize = /*256000*/BLOCK_SIZE;
|
||||
static quint64 readFileBlockSize = 65535;
|
||||
//1025*250
|
||||
|
||||
|
||||
Reference in New Issue
Block a user