diff options
Diffstat (limited to 'src/server/shared/Realm')
-rw-r--r-- | src/server/shared/Realm/RealmList.cpp | 15 | ||||
-rw-r--r-- | src/server/shared/Realm/RealmList.h | 33 |
2 files changed, 16 insertions, 32 deletions
diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp index 779bb6fca09..d4a9938476b 100644 --- a/src/server/shared/Realm/RealmList.cpp +++ b/src/server/shared/Realm/RealmList.cpp @@ -53,7 +53,7 @@ void RealmList::Initialize(Trinity::Asio::IoContext& ioContext, uint32 updateInt LoadBuildInfo(); // Get the content of the realmlist table in the database - UpdateRealms(boost::system::error_code()); + UpdateRealms(); } void RealmList::Close() @@ -113,11 +113,8 @@ void RealmList::UpdateRealm(Realm& realm, Battlenet::RealmHandle const& id, uint realm.Port = port; } -void RealmList::UpdateRealms(boost::system::error_code const& error) +void RealmList::UpdateRealms() { - if (error) - return; - TC_LOG_DEBUG("realmlist", "Updating Realm List..."); LoginDatabasePreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); @@ -207,7 +204,13 @@ 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& error) + { + if (error) + return; + + UpdateRealms(); + }); } } diff --git a/src/server/shared/Realm/RealmList.h b/src/server/shared/Realm/RealmList.h index a1262d7e913..7e85cbcfd38 100644 --- a/src/server/shared/Realm/RealmList.h +++ b/src/server/shared/Realm/RealmList.h @@ -39,35 +39,15 @@ struct RealmBuildInfo std::array<uint8, 16> Mac64AuthSeed; }; -namespace boost +namespace bgs::protocol::game_utilities::v1 { - namespace system - { - class error_code; - } +class ClientResponse; +class GetAllValuesForAttributeResponse; } -namespace bgs +namespace JSON::RealmList { - namespace protocol - { - namespace game_utilities - { - namespace v1 - { - class ClientResponse; - class GetAllValuesForAttributeResponse; - } - } - } -} - -namespace JSON -{ - namespace RealmList - { - class RealmListUpdates; - } +class RealmListUpdates; } /// Storage object for the list of realms on the server @@ -99,7 +79,7 @@ private: RealmList(); void LoadBuildInfo(); - void UpdateRealms(boost::system::error_code const& error); + void UpdateRealms(); void UpdateRealm(Realm& realm, Battlenet::RealmHandle const& id, uint32 build, std::string const& name, boost::asio::ip::address&& address, boost::asio::ip::address&& localAddr, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population); @@ -114,4 +94,5 @@ private: }; #define sRealmList RealmList::Instance() + #endif |