Skip to content

Commit

Permalink
Core/Auth: Fix the "Added realm" spam
Browse files Browse the repository at this point in the history
  • Loading branch information
DDuarte committed Mar 7, 2016
1 parent 6cd63ca commit 7b687be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/server/authserver/Realms/RealmList.cpp
Expand Up @@ -38,7 +38,7 @@ void RealmList::Initialize(boost::asio::io_service& ioService, uint32 updateInte
_resolver = new boost::asio::ip::tcp::resolver(ioService);

// Get the content of the realmlist table in the database
UpdateRealms(boost::system::error_code());
UpdateRealms(true, boost::system::error_code());
}

void RealmList::Close()
Expand Down Expand Up @@ -67,7 +67,7 @@ void RealmList::UpdateRealm(RealmHandle const& id, uint32 build, const std::stri
realm.Port = port;
}

void RealmList::UpdateRealms(boost::system::error_code const& error)
void RealmList::UpdateRealms(bool init, boost::system::error_code const& error)
{
if (error)
return;
Expand Down Expand Up @@ -138,7 +138,8 @@ void RealmList::UpdateRealms(boost::system::error_code const& error)
UpdateRealm(id, build, name, externalAddress, localAddress, localSubmask, port, icon, flag,
timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop);

TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), externalAddress.to_string().c_str(), port);
if (init)
TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), externalAddress.to_string().c_str(), port);
}
catch (std::exception& ex)
{
Expand All @@ -152,7 +153,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(std::bind(&RealmList::UpdateRealms, this, false, std::placeholders::_1));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/authserver/Realms/RealmList.h
Expand Up @@ -51,7 +51,7 @@ class RealmList
private:
RealmList();

void UpdateRealms(boost::system::error_code const& error);
void UpdateRealms(bool init, boost::system::error_code const& error);
void UpdateRealm(RealmHandle const& id, uint32 build, const std::string& name, ip::address const& address, ip::address const& localAddr,
ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population);

Expand Down

0 comments on commit 7b687be

Please sign in to comment.