1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Disconnection on error

This commit is contained in:
nordsoft
2022-11-16 23:53:54 +04:00
parent 179cdee424
commit 4527bd1a61
7 changed files with 25 additions and 4 deletions

View File

@ -40,6 +40,8 @@ void Lobby::serverCommand(const ServerCommand & command) try
case SRVERROR:
protocolAssert(args.size());
chatMessage("System error", args[0], true);
if(authentificationStatus == 0)
authentificationStatus = 2;
break;
case CREATED:
@ -138,6 +140,11 @@ void Lobby::serverCommand(const ServerCommand & command) try
chatMessage(args[0], msg);
break;
}
if(authentificationStatus == 2)
socketLobby.disconnectServer();
else
authentificationStatus = 1;
}
catch(const ProtocolError & e)
{
@ -170,6 +177,7 @@ catch(const ProtocolError & e)
void Lobby::onDisconnected()
{
authentificationStatus = 0;
ui->stackedWidget->setCurrentWidget(ui->sessionsPage);
ui->connectButton->setChecked(false);
}
@ -209,6 +217,7 @@ void Lobby::on_connectButton_toggled(bool checked)
{
if(checked)
{
authentificationStatus = 0;
username = ui->userEdit->text();
const int connectionTimeout = settings["launcher"]["connectionTimeout"].Integer();