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:
parent
614d000376
commit
9f9930a9dd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user