Core: Implemented IPC (Inter-process communication) between worldserver and bnetserver using ZeroMQ library.
* Implemented ToonReady and ToonLoggedOut battle.net packets
This commit is contained in:
1 parent
40cff79b25
commit
f773a9e053
72 files changed
+4922
-68
No files matched your search
@@ -20,13 +20,9 @@
|
||||
/// @{
|
||||
/// \file
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Commands.h"
|
||||
#include "ZmqContext.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "AsyncAcceptor.h"
|
||||
#include "RASession.h"
|
||||
@@ -47,6 +43,12 @@
|
||||
#include "SystemConfig.h"
|
||||
#include "WorldSocket.h"
|
||||
#include "WorldSocketMgr.h"
|
||||
#include "BattlenetServerManager.h"
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
using namespace boost::program_options;
|
||||
|
||||
@@ -79,7 +81,7 @@ uint32 _maxCoreStuckTimeInMs(0);
|
||||
WorldDatabaseWorkerPool WorldDatabase; ///< Accessor to the world database
|
||||
CharacterDatabaseWorkerPool CharacterDatabase; ///< Accessor to the character database
|
||||
LoginDatabaseWorkerPool LoginDatabase; ///< Accessor to the realm/login database
|
||||
uint32 realmID; ///< Id of the realm
|
||||
Battlenet::RealmHandle realmHandle; ///< Id of the realm
|
||||
|
||||
void SignalHandler(const boost::system::error_code& error, int signalNumber);
|
||||
void FreezeDetectorHandler(const boost::system::error_code& error);
|
||||
@@ -188,7 +190,7 @@ extern int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
// Set server offline (not connectable)
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmHandle.Index);
|
||||
|
||||
// Initialize the World
|
||||
sWorld->SetInitialWorldSettings();
|
||||
@@ -223,7 +225,7 @@ extern int main(int argc, char** argv)
|
||||
sWorldSocketMgr.StartNetwork(_ioService, worldListener, worldPort);
|
||||
|
||||
// Set server online (allow connecting now)
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmHandle.Index);
|
||||
|
||||
// Start the freeze check callback cycle in 5 seconds (cycle itself is 1 sec)
|
||||
if (int coreStuckTime = sConfigMgr->GetIntDefault("MaxCoreStuckTime", 0))
|
||||
@@ -234,6 +236,10 @@ extern int main(int argc, char** argv)
|
||||
TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", coreStuckTime);
|
||||
}
|
||||
|
||||
sIpcContext->Initialize();
|
||||
|
||||
sBattlenetServer.InitializeConnection();
|
||||
|
||||
TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION);
|
||||
|
||||
sScriptMgr->OnStartup();
|
||||
@@ -245,6 +251,10 @@ extern int main(int argc, char** argv)
|
||||
|
||||
sScriptMgr->OnShutdown();
|
||||
|
||||
sIpcContext->Close();
|
||||
|
||||
sBattlenetServer.CloseConnection();
|
||||
|
||||
sWorld->KickAll(); // save and kick all players
|
||||
sWorld->UpdateSessions(1); // real players unload required UpdateSessions call
|
||||
|
||||
@@ -260,7 +270,7 @@ extern int main(int argc, char** argv)
|
||||
sOutdoorPvPMgr->Die();
|
||||
|
||||
// set server offline
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
|
||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmHandle.Index);
|
||||
|
||||
// Clean up threads if any
|
||||
if (soapThread != nullptr)
|
||||
@@ -523,13 +533,24 @@ bool StartDB()
|
||||
}
|
||||
|
||||
///- Get the realm Id from the configuration file
|
||||
realmID = sConfigMgr->GetIntDefault("RealmID", 0);
|
||||
if (!realmID)
|
||||
realmHandle.Index = sConfigMgr->GetIntDefault("RealmID", 0);
|
||||
if (!realmHandle.Index)
|
||||
{
|
||||
TC_LOG_ERROR("server.worldserver", "Realm ID not defined in configuration file");
|
||||
return false;
|
||||
}
|
||||
TC_LOG_INFO("server.worldserver", "Realm running as realm ID %d", realmID);
|
||||
|
||||
QueryResult realmIdQuery = LoginDatabase.PQuery("SELECT `Region`,`Battlegroup` FROM `realmlist` WHERE `id`=%u", realmHandle.Index);
|
||||
if (!realmIdQuery)
|
||||
{
|
||||
TC_LOG_ERROR("server.worldserver", "Realm id %u not defined in realmlist table", realmHandle.Index);
|
||||
return false;
|
||||
}
|
||||
|
||||
realmHandle.Region = (*realmIdQuery)[0].GetUInt8();
|
||||
realmHandle.Battlegroup = (*realmIdQuery)[1].GetUInt8();
|
||||
|
||||
TC_LOG_INFO("server.worldserver", "Realm running as realm ID %u region %u battlegroup %u", realmHandle.Index, uint32(realmHandle.Region), uint32(realmHandle.Battlegroup));
|
||||
|
||||
///- Clean the database before starting
|
||||
ClearOnlineAccounts();
|
||||
@@ -556,7 +577,7 @@ void StopDB()
|
||||
void ClearOnlineAccounts()
|
||||
{
|
||||
// Reset online status for all accounts with characters on the current realm
|
||||
LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmID);
|
||||
LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmHandle.Index);
|
||||
|
||||
// Reset online status for all characters
|
||||
CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0");
|
||||
|
||||
Reference in new issue
Block a user