diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-06-01 13:03:30 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-06-01 13:03:30 +0200 |
| commit | dc5c5ef6361f3f4dbb5fc9b5a755951c83f954fa (patch) | |
| tree | 207e7b43ddbc9acd09b4c279b04e9a284d4709e5 /src/server/authserver/Realms | |
| parent | db2cb70120dde10ffa210ad5af8a973cc1644355 (diff) | |
Core/Authserver: Refactoring - moved GetAddressForClient to Realm structure, changed BigNumber string methods to return std::string, added missing prepared statement
Diffstat (limited to 'src/server/authserver/Realms')
| -rw-r--r-- | src/server/authserver/Realms/RealmList.cpp | 21 | ||||
| -rw-r--r-- | src/server/authserver/Realms/RealmList.h | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index bd856623faf..48b7a178c2d 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -20,8 +20,27 @@ #include "RealmList.h" #include "BattlenetManager.h" #include "Database/DatabaseEnv.h" +#include "Util.h" -RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } +ACE_INET_Addr const& Realm::GetAddressForClient(ACE_INET_Addr const& clientAddr) const +{ + // Attempt to send best address for client + if (clientAddr.is_loopback()) + // Assume that user connecting from the machine that authserver is located on + // has all realms available in his local network + return LocalAddress; + + // Check if connecting client is in the same network + if (IsIPAddrInNetwork(LocalAddress, clientAddr, LocalSubnetMask)) + return LocalAddress; + + // Return external IP + return ExternalAddress; +} + +RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) +{ +} // Load the realm list from the database void RealmList::Initialize(uint32 updateInterval) diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h index ab453720827..c4a6b4eaa0b 100644 --- a/src/server/authserver/Realms/RealmList.h +++ b/src/server/authserver/Realms/RealmList.h @@ -53,6 +53,8 @@ struct Realm uint32 gamebuild; uint8 Region; uint8 Battlegroup; + + ACE_INET_Addr const& GetAddressForClient(ACE_INET_Addr const& clientAddr) const; }; namespace Battlenet |
