mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
CServerHandler::justConnectToServer(): Read settings only once
This commit is contained in:
@@ -251,14 +251,16 @@ void CServerHandler::startLocalServerAndConnect()
|
|||||||
void CServerHandler::justConnectToServer(const std::string & addr, const ui16 port)
|
void CServerHandler::justConnectToServer(const std::string & addr, const ui16 port)
|
||||||
{
|
{
|
||||||
state = EClientState::CONNECTING;
|
state = EClientState::CONNECTING;
|
||||||
|
std::string hostAddress = getHostAddress();
|
||||||
|
ui16 hostPort = getHostPort();
|
||||||
|
logNetwork->info("Establishing connection...");
|
||||||
while(!c && state != EClientState::CONNECTION_CANCELLED)
|
while(!c && state != EClientState::CONNECTION_CANCELLED)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logNetwork->info("Establishing connection...");
|
|
||||||
c = std::make_shared<CConnection>(
|
c = std::make_shared<CConnection>(
|
||||||
addr.size() ? addr : getHostAddress(),
|
addr.size() ? addr : hostAddress,
|
||||||
port ? port : getHostPort(),
|
port ? port : hostPort,
|
||||||
NAME, uuid);
|
NAME, uuid);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error & error)
|
catch(std::runtime_error & error)
|
||||||
|
|||||||
Reference in New Issue
Block a user