1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

CServerHandler::justConnectToServer(): Read settings only once

This commit is contained in:
Alexander Wilms 2023-09-27 15:55:15 +02:00
parent 614d000376
commit 9f9930a9dd

View File

@ -251,14 +251,16 @@ void CServerHandler::startLocalServerAndConnect()
void CServerHandler::justConnectToServer(const std::string & addr, const ui16 port)
{
state = EClientState::CONNECTING;
std::string hostAddress = getHostAddress();
ui16 hostPort = getHostPort();
logNetwork->info("Establishing connection...");
while(!c && state != EClientState::CONNECTION_CANCELLED)
{
try
{
logNetwork->info("Establishing connection...");
c = std::make_shared<CConnection>(
addr.size() ? addr : getHostAddress(),
port ? port : getHostPort(),
addr.size() ? addr : hostAddress,
port ? port : hostPort,
NAME, uuid);
}
catch(std::runtime_error & error)