diff --git a/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp b/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp index c809e27..3a54eb4 100644 --- a/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -284,10 +284,13 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization ui->btnPersonalCard->setEnabled(false); updateLabelLoggedInInstructor(instructorLoggedInLocal); + + waitAnimationWidget->hideWithStop(); } else { ui->btnAuthorizationInstructor->setChecked(true); + waitAnimationWidget->hideWithStop(); SpecMsgBox::CriticalClose(this, tr("Instructor deauthorization") + "\n" + tr("Error!")); } } @@ -300,7 +303,7 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked() waitAnimationWidget->hideWithStop(); 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.")); } } @@ -548,7 +551,7 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent } bool InstructorsAndTraineesWidget::deAuthorizationInstructor(QString login) -{ +{ connectorToServer->sendDeAuthorizationInstructorLocal(login); return true; } @@ -596,6 +599,8 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked() {//ДеАвторизация Инструктора локальная (Администратора) if(authorizationIsCompleted()) { + waitAnimationWidget->showWithPlay(); + if(deAuthorizationInstructor(instructorLoggedInLocal.getLogin())) { /* diff --git a/LibServer/Data/typesDataServerClient.h b/LibServer/Data/typesDataServerClient.h index 7a6ab49..5db5438 100644 --- a/LibServer/Data/typesDataServerClient.h +++ b/LibServer/Data/typesDataServerClient.h @@ -11,7 +11,6 @@ #define NOTIFY_ERROR_AUTH_ALREADYLOGIN "ERROR_AUTH_ALREADYLOGIN" #define NOTIFY_SERVER_END "END" #define NOTIFY_SERVER_BLOCKED "BLOCKED" -#define SERVER_HELLO "NewConnection. I am server LMS!" enum EStateServer{started, stoped}; enum EStateBlockAutorization{blocked, unblocked}; diff --git a/LibServer/Systems/commonclienthandler.cpp b/LibServer/Systems/commonclienthandler.cpp index 0c31014..7e3bb5d 100644 --- a/LibServer/Systems/commonclienthandler.cpp +++ b/LibServer/Systems/commonclienthandler.cpp @@ -111,7 +111,7 @@ void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType) { ClientHandler *handler = clientsMap->value(idSocket); - if(packetType != PacketType::BUSY && packetType != PacketType::FREE) + //if(packetType != PacketType::BUSY && packetType != PacketType::FREE) if (!handler->getClient()->getIsLoggedIn()) continue; handler->sendPacketType(packetType); diff --git a/LibServer/Systems/processingsystem.cpp b/LibServer/Systems/processingsystem.cpp index c6c1d2a..dfcf289 100644 --- a/LibServer/Systems/processingsystem.cpp +++ b/LibServer/Systems/processingsystem.cpp @@ -96,6 +96,14 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien { client->sendVersion(); + //Отправляем состояние блокировки + /**/ + if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked) + client->sendPacketType(PacketType::BUSY); + else + client->sendPacketType(PacketType::FREE); + + //client->sendPacketType(PacketType::BUSY); //client->sendPacketType(PacketType::FREE); diff --git a/LibServer/Systems/sendsystem.cpp b/LibServer/Systems/sendsystem.cpp index 7bed218..e506fff 100644 --- a/LibServer/Systems/sendsystem.cpp +++ b/LibServer/Systems/sendsystem.cpp @@ -231,11 +231,6 @@ void SendSystem::sendPacketType(PacketType packetType) } -void SendSystem::sendHello() -{ - socket->write(SERVER_HELLO); -} - void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType) { qDebug() << "SendSystemThread: " << QThread::currentThreadId(); diff --git a/LibServer/Systems/sendsystem.h b/LibServer/Systems/sendsystem.h index 12b80b5..96cba97 100644 --- a/LibServer/Systems/sendsystem.h +++ b/LibServer/Systems/sendsystem.h @@ -29,7 +29,6 @@ public: void sendFolderBlock(QString path); void sendDeleteBlock(QString path); void sendPacketType(PacketType packet); - void sendHello(); void sendNotify(QString notify); void sendStop(); void sendDocs(QString docPath); diff --git a/LibServer/clienthandler/clienthandler.cpp b/LibServer/clienthandler/clienthandler.cpp index d7be669..8e74f23 100644 --- a/LibServer/clienthandler/clienthandler.cpp +++ b/LibServer/clienthandler/clienthandler.cpp @@ -39,7 +39,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget, client = new Client(peerName,peerAddress,peerPort,socket); 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::sigFileBlockByteArray,sendSystem,&SendSystem::sendFileBlockByteArray,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); emit sigInitSender(dataParser,serverWidget->getMutex()); + Logger::instance().log("SERVER: Client connected"); } void ClientHandler::setClient(Client *value) diff --git a/LibServer/multithreadserver/multithreadserver.cpp b/LibServer/multithreadserver/multithreadserver.cpp index cbe241e..bb4fb18 100644 --- a/LibServer/multithreadserver/multithreadserver.cpp +++ b/LibServer/multithreadserver/multithreadserver.cpp @@ -18,20 +18,22 @@ void MultiThreadServer::incomingConnection(qintptr socketDesriptor) { 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); emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser); disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize); addClient(socketDesriptor,newClient); - Logger::instance().log("To Client: " + QString(SERVER_HELLO)); + //Logger::instance().log("To Client: " + QString(SERVER_HELLO)); //Отправляем состояние блокировки + /* if(getStateBlockAutorization() == EStateBlockAutorization::blocked) newClient->sendPacketType(PacketType::BUSY); else - newClient->sendPacketType(PacketType::FREE); + newClient->sendPacketType(PacketType::FREE);*/ + } bool MultiThreadServer::startServer()