Fixed build for newer boost versions

This commit is contained in:
Ovahlord committed 2019-09-12 03:16:24 +02:00
1 parent 66bdfee4ee
commit 78e5791f19
4 files changed
+14 -15

No files matched your search

+12 -11
View File
@@ -31,6 +31,7 @@
#include "Config.h"
#include "DatabaseEnv.h"
#include "DatabaseLoader.h"
#include "DeadlineTimer.h"
#include "IoContext.h"
#include "MySQLThreading.h"
#include "ModuleManager.h"
@@ -69,13 +70,13 @@ char serviceDescription[] = "TrinityCore Battle.net emulator authentication serv
*/
int m_ServiceStatus = -1;
void ServiceStatusWatcher(std::weak_ptr<boost::asio::deadline_timer> serviceStatusWatchTimerRef, std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::system::error_code const& error);
void ServiceStatusWatcher(std::weak_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimerRef, std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::system::error_code const& error);
#endif
bool StartDB();
void StopDB();
void SignalHandler(std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::system::error_code const& error, int signalNumber);
void KeepDatabaseAliveHandler(std::weak_ptr<boost::asio::deadline_timer> dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error);
void KeepDatabaseAliveHandler(std::weak_ptr<Trinity::Asio::DeadlineTimer> dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error);
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, std::string& configService);
int main(int argc, char** argv)
@@ -194,18 +195,18 @@ int main(int argc, char** argv)
// Enabled a timed callback for handling the database keep alive ping
int32 dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30);
std::shared_ptr<boost::asio::deadline_timer> dbPingTimer = std::make_shared<boost::asio::deadline_timer>(*ioContext);
std::shared_ptr<Trinity::Asio::DeadlineTimer> dbPingTimer = std::make_shared<Trinity::Asio::DeadlineTimer>(*ioContext);
dbPingTimer->expires_from_now(boost::posix_time::minutes(dbPingInterval));
dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, std::weak_ptr<boost::asio::deadline_timer>(dbPingTimer), dbPingInterval, std::placeholders::_1));
dbPingTimer->async_wait(std::bind(&KeepDatabaseAliveHandler, std::weak_ptr<Trinity::Asio::DeadlineTimer>(dbPingTimer), dbPingInterval, std::placeholders::_1));
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
std::shared_ptr<boost::asio::deadline_timer> serviceStatusWatchTimer;
std::shared_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimer;
if (m_ServiceStatus != -1)
{
serviceStatusWatchTimer = std::make_shared<boost::asio::deadline_timer>(*ioContext);
serviceStatusWatchTimer = std::make_shared<Trinity::Asio::DeadlineTimer>(*ioContext);
serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1));
serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher,
std::weak_ptr<boost::asio::deadline_timer>(serviceStatusWatchTimer),
std::weak_ptr<Trinity::Asio::DeadlineTimer>(serviceStatusWatchTimer),
std::weak_ptr<Trinity::Asio::IoContext>(ioContext),
std::placeholders::_1));
}
@@ -259,11 +260,11 @@ void SignalHandler(std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::
ioContext->stop();
}
void KeepDatabaseAliveHandler(std::weak_ptr<boost::asio::deadline_timer> dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error)
void KeepDatabaseAliveHandler(std::weak_ptr<Trinity::Asio::DeadlineTimer> dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error)
{
if (!error)
{
if (std::shared_ptr<boost::asio::deadline_timer> dbPingTimer = dbPingTimerRef.lock())
if (std::shared_ptr<Trinity::Asio::DeadlineTimer> dbPingTimer = dbPingTimerRef.lock())
{
TC_LOG_INFO("server.bnetserver", "Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();
@@ -275,7 +276,7 @@ void KeepDatabaseAliveHandler(std::weak_ptr<boost::asio::deadline_timer> dbPingT
}
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
void ServiceStatusWatcher(std::weak_ptr<boost::asio::deadline_timer> serviceStatusWatchTimerRef, std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::system::error_code const& error)
void ServiceStatusWatcher(std::weak_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimerRef, std::weak_ptr<Trinity::Asio::IoContext> ioContextRef, boost::system::error_code const& error)
{
if (!error)
{
@@ -285,7 +286,7 @@ void ServiceStatusWatcher(std::weak_ptr<boost::asio::deadline_timer> serviceStat
{
ioContext->stop();
}
else if (std::shared_ptr<boost::asio::deadline_timer> serviceStatusWatchTimer = serviceStatusWatchTimerRef.lock())
else if (std::shared_ptr<Trinity::Asio::DeadlineTimer> serviceStatusWatchTimer = serviceStatusWatchTimerRef.lock())
{
serviceStatusWatchTimer->expires_from_now(boost::posix_time::seconds(1));
serviceStatusWatchTimer->async_wait(std::bind(&ServiceStatusWatcher, serviceStatusWatchTimerRef, ioContext, std::placeholders::_1));