This commit is contained in:
2026-01-23 15:08:57 +03:00
parent 19222cd855
commit 82c667cfd0
8 changed files with 23 additions and 14 deletions

View File

@@ -284,10 +284,13 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
ui->btnPersonalCard->setEnabled(false); ui->btnPersonalCard->setEnabled(false);
updateLabelLoggedInInstructor(instructorLoggedInLocal); updateLabelLoggedInInstructor(instructorLoggedInLocal);
waitAnimationWidget->hideWithStop();
} }
else else
{ {
ui->btnAuthorizationInstructor->setChecked(true); ui->btnAuthorizationInstructor->setChecked(true);
waitAnimationWidget->hideWithStop();
SpecMsgBox::CriticalClose(this, tr("Instructor deauthorization") + "\n" + tr("Error!")); SpecMsgBox::CriticalClose(this, tr("Instructor deauthorization") + "\n" + tr("Error!"));
} }
} }
@@ -300,7 +303,7 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked()
waitAnimationWidget->hideWithStop(); waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false); ui->btnAuthorizationInstructor->setChecked(false);
SpecMsgBox::WarningClose(this, tr("Instructor authorization.") + "\n" + tr("Server blocked!")); SpecMsgBox::WarningClose(this, tr("Instructor authorization is temporarily unavailable.") + "\n" + tr("Server blocked!") + "\n" + tr("Try again later."));
} }
} }
@@ -596,6 +599,8 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
{//ДеАвторизация Инструктора локальная (Администратора) {//ДеАвторизация Инструктора локальная (Администратора)
if(authorizationIsCompleted()) if(authorizationIsCompleted())
{ {
waitAnimationWidget->showWithPlay();
if(deAuthorizationInstructor(instructorLoggedInLocal.getLogin())) if(deAuthorizationInstructor(instructorLoggedInLocal.getLogin()))
{ {
/* /*

View File

@@ -11,7 +11,6 @@
#define NOTIFY_ERROR_AUTH_ALREADYLOGIN "ERROR_AUTH_ALREADYLOGIN" #define NOTIFY_ERROR_AUTH_ALREADYLOGIN "ERROR_AUTH_ALREADYLOGIN"
#define NOTIFY_SERVER_END "END" #define NOTIFY_SERVER_END "END"
#define NOTIFY_SERVER_BLOCKED "BLOCKED" #define NOTIFY_SERVER_BLOCKED "BLOCKED"
#define SERVER_HELLO "NewConnection. I am server LMS!"
enum EStateServer{started, stoped}; enum EStateServer{started, stoped};
enum EStateBlockAutorization{blocked, unblocked}; enum EStateBlockAutorization{blocked, unblocked};

View File

@@ -111,7 +111,7 @@ void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
{ {
ClientHandler *handler = clientsMap->value(idSocket); ClientHandler *handler = clientsMap->value(idSocket);
if(packetType != PacketType::BUSY && packetType != PacketType::FREE) //if(packetType != PacketType::BUSY && packetType != PacketType::FREE)
if (!handler->getClient()->getIsLoggedIn()) continue; if (!handler->getClient()->getIsLoggedIn()) continue;
handler->sendPacketType(packetType); handler->sendPacketType(packetType);

View File

@@ -96,6 +96,14 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
{ {
client->sendVersion(); client->sendVersion();
//Отправляем состояние блокировки
/**/
if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked)
client->sendPacketType(PacketType::BUSY);
else
client->sendPacketType(PacketType::FREE);
//client->sendPacketType(PacketType::BUSY); //client->sendPacketType(PacketType::BUSY);
//client->sendPacketType(PacketType::FREE); //client->sendPacketType(PacketType::FREE);

View File

@@ -231,11 +231,6 @@ void SendSystem::sendPacketType(PacketType packetType)
} }
void SendSystem::sendHello()
{
socket->write(SERVER_HELLO);
}
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType) void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
{ {
qDebug() << "SendSystemThread: " << QThread::currentThreadId(); qDebug() << "SendSystemThread: " << QThread::currentThreadId();

View File

@@ -29,7 +29,6 @@ public:
void sendFolderBlock(QString path); void sendFolderBlock(QString path);
void sendDeleteBlock(QString path); void sendDeleteBlock(QString path);
void sendPacketType(PacketType packet); void sendPacketType(PacketType packet);
void sendHello();
void sendNotify(QString notify); void sendNotify(QString notify);
void sendStop(); void sendStop();
void sendDocs(QString docPath); void sendDocs(QString docPath);

View File

@@ -39,7 +39,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
client = new Client(peerName,peerAddress,peerPort,socket); client = new Client(peerName,peerAddress,peerPort,socket);
connect(this,&ClientHandler::sigSendXmlAnswer,sendSystem,&SendSystem::sendXmlAnswer,Qt::AutoConnection); connect(this,&ClientHandler::sigSendXmlAnswer,sendSystem,&SendSystem::sendXmlAnswer,Qt::AutoConnection);
connect(this,&ClientHandler::sigInitSender,sendSystem,&SendSystem::initialize,Qt::AutoConnection); connect(this,&ClientHandler::sigInitSender,sendSystem,&SendSystem::initialize,Qt::AutoConnection/*Qt::DirectConnection*/);
connect(this,&ClientHandler::sigFileBlock,sendSystem,&SendSystem::sendFileBlock,Qt::AutoConnection); connect(this,&ClientHandler::sigFileBlock,sendSystem,&SendSystem::sendFileBlock,Qt::AutoConnection);
connect(this,&ClientHandler::sigFileBlockByteArray,sendSystem,&SendSystem::sendFileBlockByteArray,Qt::AutoConnection); connect(this,&ClientHandler::sigFileBlockByteArray,sendSystem,&SendSystem::sendFileBlockByteArray,Qt::AutoConnection);
connect(this,&ClientHandler::sigFolderBlock,sendSystem,&SendSystem::sendFolderBlock,Qt::AutoConnection); connect(this,&ClientHandler::sigFolderBlock,sendSystem,&SendSystem::sendFolderBlock,Qt::AutoConnection);
@@ -61,6 +61,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
sendSystem->setClient(client,socket); sendSystem->setClient(client,socket);
emit sigInitSender(dataParser,serverWidget->getMutex()); emit sigInitSender(dataParser,serverWidget->getMutex());
Logger::instance().log("SERVER: Client connected");
} }
void ClientHandler::setClient(Client *value) void ClientHandler::setClient(Client *value)

View File

@@ -18,20 +18,22 @@ 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/*Qt::DirectConnection*/);
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection); connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection);
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser); emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser);
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize); disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
addClient(socketDesriptor,newClient); addClient(socketDesriptor,newClient);
Logger::instance().log("To Client: " + QString(SERVER_HELLO)); //Logger::instance().log("To Client: " + QString(SERVER_HELLO));
//Отправляем состояние блокировки //Отправляем состояние блокировки
/*
if(getStateBlockAutorization() == EStateBlockAutorization::blocked) if(getStateBlockAutorization() == EStateBlockAutorization::blocked)
newClient->sendPacketType(PacketType::BUSY); newClient->sendPacketType(PacketType::BUSY);
else else
newClient->sendPacketType(PacketType::FREE); newClient->sendPacketType(PacketType::FREE);*/
} }
bool MultiThreadServer::startServer() bool MultiThreadServer::startServer()