chore(Core/Shared): little cleanup (#18385)

This commit is contained in:
Winfidonarleyan
2024-02-25 22:07:08 +07:00
committed by GitHub
parent 27da4554cf
commit 2a2cc3c22f
10 changed files with 25 additions and 37 deletions

View File

@@ -24,7 +24,7 @@ boost::asio::ip::tcp_endpoint Realm::GetAddressForClient(boost::asio::ip::addres
{
boost::asio::ip::address realmIp;
// Attempt to send best address for client
// Attempt to send best address for a client
if (clientAddr.is_loopback())
{
// Try guessing if realm is also connected locally
@@ -52,5 +52,5 @@ boost::asio::ip::tcp_endpoint Realm::GetAddressForClient(boost::asio::ip::addres
}
// Return external IP
return boost::asio::ip::tcp_endpoint(realmIp, Port);
return { realmIp, Port };
}

View File

@@ -92,7 +92,7 @@ void RealmList::LoadBuildInfo()
void RealmList::UpdateRealm(RealmHandle const& id, uint32 build, std::string const& name,
boost::asio::ip::address&& address, boost::asio::ip::address&& localAddr, boost::asio::ip::address&& localSubmask,
uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population)
uint16 port, uint8 icon, RealmFlags flag, uint8 realmTimezone, AccountTypes allowedSecurityLevel, float population)
{
// Create new if not exist or update existed
Realm& realm = _realms[id];
@@ -102,7 +102,7 @@ void RealmList::UpdateRealm(RealmHandle const& id, uint32 build, std::string con
realm.Name = name;
realm.Type = icon;
realm.Flags = flag;
realm.Timezone = timezone;
realm.Timezone = realmTimezone;
realm.AllowedSecurityLevel = allowedSecurityLevel;
realm.PopulationLevel = population;
@@ -192,8 +192,8 @@ void RealmList::UpdateRealms(boost::system::error_code const& error)
icon = REALM_TYPE_NORMAL;
}
RealmFlags flag = RealmFlags(fields[7].Get<uint8>());
uint8 timezone = fields[8].Get<uint8>();
auto flag = RealmFlags(fields[7].Get<uint8>());
uint8 realmTimezone = fields[8].Get<uint8>();
uint8 allowedSecurityLevel = fields[9].Get<uint8>();
float pop = fields[10].Get<float>();
uint32 build = fields[11].Get<uint32>();
@@ -201,7 +201,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error)
RealmHandle id{ realmId };
UpdateRealm(id, build, name, externalAddress->address(), localAddress->address(), localSubmask->address(), port, icon, flag,
timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop);
realmTimezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop);
if (!existingRealms.count(id))
{
@@ -228,7 +228,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error)
if (_updateInterval)
{
_updateTimer->expires_from_now(boost::posix_time::seconds(_updateInterval));
_updateTimer->async_wait(std::bind(&RealmList::UpdateRealms, this, std::placeholders::_1));
_updateTimer->async_wait([this](boost::system::error_code const& errorCode){ UpdateRealms(errorCode); });
}
}

View File

@@ -65,7 +65,7 @@ private:
void UpdateRealms(boost::system::error_code const& error);
void UpdateRealm(RealmHandle const& id, uint32 build, std::string const& name,
boost::asio::ip::address&& address, boost::asio::ip::address&& localAddr, boost::asio::ip::address&& localSubmask,
uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population);
uint16 port, uint8 icon, RealmFlags flag, uint8 realmTimezone, AccountTypes allowedSecurityLevel, float population);
std::vector<RealmBuildInfo> _builds;
RealmMap _realms;