diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index dd034d36a..0a88eafe8 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -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( - addr.size() ? addr : getHostAddress(), - port ? port : getHostPort(), + addr.size() ? addr : hostAddress, + port ? port : hostPort, NAME, uuid); } catch(std::runtime_error & error)