aboutsummaryrefslogtreecommitdiff
path: root/src/server/bnetserver
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-11-09 00:37:33 +0100
committerShauren <shauren.trinity@gmail.com>2014-11-09 00:37:33 +0100
commitbacc90b6baa34e6a194c93e5a7860d4041f08af7 (patch)
treede99e93636f809f1179cb7336af307b70cae13ec /src/server/bnetserver
parent6c1ca104edd07adf99e7946fa9b46ce4a849bd5d (diff)
Core/NetworkIO: Added second connection to WorldSession, handle AuthContinuedSession and enabled ConnectTo and ResumeComms
Diffstat (limited to 'src/server/bnetserver')
-rw-r--r--src/server/bnetserver/CMakeLists.txt1
-rw-r--r--src/server/bnetserver/Realms/RealmList.cpp43
-rw-r--r--src/server/bnetserver/Realms/RealmList.h62
-rw-r--r--src/server/bnetserver/Realms/WorldListener.cpp4
4 files changed, 5 insertions, 105 deletions
diff --git a/src/server/bnetserver/CMakeLists.txt b/src/server/bnetserver/CMakeLists.txt
index 5b854018d47..5d1edef5b81 100644
--- a/src/server/bnetserver/CMakeLists.txt
+++ b/src/server/bnetserver/CMakeLists.txt
@@ -55,6 +55,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
${CMAKE_SOURCE_DIR}/src/server/shared/Networking
+ ${CMAKE_SOURCE_DIR}/src/server/shared/Realm
${CMAKE_SOURCE_DIR}/src/server/shared/Threading
${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
${CMAKE_SOURCE_DIR}/src/server/ipc
diff --git a/src/server/bnetserver/Realms/RealmList.cpp b/src/server/bnetserver/Realms/RealmList.cpp
index cc7e1d492a8..a876aa93a07 100644
--- a/src/server/bnetserver/Realms/RealmList.cpp
+++ b/src/server/bnetserver/Realms/RealmList.cpp
@@ -24,49 +24,6 @@
#include "RealmList.h"
#include <boost/asio/ip/tcp.hpp>
-Battlenet::RealmId& Battlenet::RealmId::operator=(Battlenet::RealmHandle const& handle)
-{
- Region = handle.Region;
- Battlegroup = handle.Battlegroup;
- Index = handle.Index;
- return *this;
-}
-
-ip::tcp::endpoint Realm::GetAddressForClient(ip::address const& clientAddr) const
-{
- ip::address realmIp;
-
- // Attempt to send best address for client
- if (clientAddr.is_loopback())
- {
- // Try guessing if realm is also connected locally
- if (LocalAddress.is_loopback() || ExternalAddress.is_loopback())
- realmIp = clientAddr;
- else
- {
- // Assume that user connecting from the machine that bnetserver is located on
- // has all realms available in his local network
- realmIp = LocalAddress;
- }
- }
- else
- {
- if (clientAddr.is_v4() &&
- (clientAddr.to_v4().to_ulong() & LocalSubnetMask.to_v4().to_ulong()) ==
- (LocalAddress.to_v4().to_ulong() & LocalSubnetMask.to_v4().to_ulong()))
- {
- realmIp = LocalAddress;
- }
- else
- realmIp = ExternalAddress;
- }
-
- ip::tcp::endpoint endpoint(realmIp, Port);
-
- // Return external IP
- return endpoint;
-}
-
RealmList::RealmList() : _updateInterval(0), _updateTimer(nullptr), _resolver(nullptr), _worldListener(nullptr)
{
}
diff --git a/src/server/bnetserver/Realms/RealmList.h b/src/server/bnetserver/Realms/RealmList.h
index dc78a00dfdd..718e26d2564 100644
--- a/src/server/bnetserver/Realms/RealmList.h
+++ b/src/server/bnetserver/Realms/RealmList.h
@@ -20,6 +20,7 @@
#define _REALMLIST_H
#include "Common.h"
+#include "Realm.h"
#include "WorldListener.h"
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ip/tcp.hpp>
@@ -28,67 +29,6 @@
using namespace boost::asio;
-enum RealmFlags
-{
- REALM_FLAG_NONE = 0x00,
- REALM_FLAG_INVALID = 0x01,
- REALM_FLAG_OFFLINE = 0x02,
- REALM_FLAG_SPECIFYBUILD = 0x04,
- REALM_FLAG_UNK1 = 0x08,
- REALM_FLAG_UNK2 = 0x10,
- REALM_FLAG_RECOMMENDED = 0x20,
- REALM_FLAG_NEW = 0x40,
- REALM_FLAG_FULL = 0x80
-};
-
-#pragma pack(push, 1)
-
-namespace Battlenet
-{
- struct RealmHandle;
-
- struct RealmId
- {
- RealmId() : Region(0), Battlegroup(0), Index(0), Build(0) { }
- RealmId(uint8 region, uint8 battlegroup, uint32 index, uint32 build)
- : Region(region), Battlegroup(battlegroup), Index(index), Build(build) { }
-
- uint8 Region;
- uint8 Battlegroup;
- uint32 Index;
- uint32 Build;
-
- bool operator<(RealmId const& r) const
- {
- return memcmp(this, &r, sizeof(RealmId) - sizeof(Build)) < 0;
- }
-
- RealmId& operator=(RealmHandle const& handle);
- };
-}
-
-#pragma pack(pop)
-
-// Storage object for a realm
-struct Realm
-{
- Battlenet::RealmId Id;
- ip::address ExternalAddress;
- ip::address LocalAddress;
- ip::address LocalSubnetMask;
- uint16 Port;
- std::string Name;
- uint8 Type;
- RealmFlags Flags;
- uint8 Timezone;
- AccountTypes AllowedSecurityLevel;
- float PopulationLevel;
- bool Updated;
- bool Keep;
-
- ip::tcp::endpoint GetAddressForClient(ip::address const& clientAddr) const;
-};
-
/// Storage object for the list of realms on the server
class RealmList
{
diff --git a/src/server/bnetserver/Realms/WorldListener.cpp b/src/server/bnetserver/Realms/WorldListener.cpp
index 30886a67310..9c9f1029e87 100644
--- a/src/server/bnetserver/Realms/WorldListener.cpp
+++ b/src/server/bnetserver/Realms/WorldListener.cpp
@@ -98,7 +98,9 @@ void WorldListener::HandleToonOnlineStatusChange(Battlenet::RealmHandle const& r
if (online)
{
Battlenet::WoWRealm::ToonReady* toonReady = new Battlenet::WoWRealm::ToonReady();
- toonReady->Realm = realm;
+ toonReady->Realm.Battlegroup = realm.Battlegroup;
+ toonReady->Realm.Index = realm.Index;
+ toonReady->Realm.Region = realm.Region;
toonReady->Guid = toonHandle.Guid;
toonReady->Name = toonHandle.Name;
session->AsyncWrite(toonReady);