mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include "ACSoap.h"
|
||||
#include "AppenderDB.h"
|
||||
#include "AsyncAcceptor.h"
|
||||
#include "AsyncAuctionListing.h"
|
||||
#include "Banner.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BigNumber.h"
|
||||
@@ -31,7 +30,6 @@
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseLoader.h"
|
||||
#include "DeadlineTimer.h"
|
||||
#include "GitRevision.h"
|
||||
#include "IoContext.h"
|
||||
#include "MapMgr.h"
|
||||
@@ -92,14 +90,16 @@ public:
|
||||
|
||||
static void Start(std::shared_ptr<FreezeDetector> const& freezeDetector)
|
||||
{
|
||||
freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(5));
|
||||
// Calculate the expiration time 5seconds from now
|
||||
auto expirationTime = std::chrono::steady_clock::now() + std::chrono::seconds(5);
|
||||
freezeDetector->_timer.expires_at(expirationTime);
|
||||
freezeDetector->_timer.async_wait(std::bind(&FreezeDetector::Handler, std::weak_ptr<FreezeDetector>(freezeDetector), std::placeholders::_1));
|
||||
}
|
||||
|
||||
static void Handler(std::weak_ptr<FreezeDetector> freezeDetectorRef, boost::system::error_code const& error);
|
||||
|
||||
private:
|
||||
Acore::Asio::DeadlineTimer _timer;
|
||||
boost::asio::steady_timer _timer;
|
||||
uint32 _worldLoopCounter;
|
||||
uint32 _lastChangeMsTime;
|
||||
uint32 _maxCoreStuckTimeInMs;
|
||||
@@ -112,7 +112,6 @@ void StopDB();
|
||||
bool LoadRealmInfo(Acore::Asio::IoContext& ioContext);
|
||||
AsyncAcceptor* StartRaSocketAcceptor(Acore::Asio::IoContext& ioContext);
|
||||
void ShutdownCLIThread(std::thread* cliThread);
|
||||
void AuctionListingRunnable();
|
||||
void WorldUpdateLoop();
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& cfg_service);
|
||||
|
||||
@@ -398,15 +397,6 @@ int main(int argc, char** argv)
|
||||
cliThread.reset(new std::thread(CliThread), &ShutdownCLIThread);
|
||||
}
|
||||
|
||||
// Launch auction listing thread
|
||||
std::shared_ptr<std::thread> auctionListingThread;
|
||||
auctionListingThread.reset(new std::thread(AuctionListingRunnable),
|
||||
[](std::thread* thr)
|
||||
{
|
||||
thr->join();
|
||||
delete thr;
|
||||
});
|
||||
|
||||
WorldUpdateLoop();
|
||||
|
||||
// Shutdown starts here
|
||||
@@ -654,7 +644,9 @@ void FreezeDetector::Handler(std::weak_ptr<FreezeDetector> freezeDetectorRef, bo
|
||||
}
|
||||
}
|
||||
|
||||
freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(1));
|
||||
// Calculate the expiration time
|
||||
auto expirationTime = std::chrono::steady_clock::now() + std::chrono::seconds(1);
|
||||
freezeDetector->_timer.expires_at(expirationTime);
|
||||
freezeDetector->_timer.async_wait(std::bind(&FreezeDetector::Handler, freezeDetectorRef, std::placeholders::_1));
|
||||
}
|
||||
}
|
||||
@@ -725,55 +717,6 @@ bool LoadRealmInfo(Acore::Asio::IoContext& ioContext)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AuctionListingRunnable()
|
||||
{
|
||||
LOG_INFO("server", "Starting up Auction House Listing thread...");
|
||||
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
Milliseconds diff = AsyncAuctionListingMgr::GetDiff();
|
||||
AsyncAuctionListingMgr::ResetDiff();
|
||||
|
||||
if (!AsyncAuctionListingMgr::GetTempList().empty() || !AsyncAuctionListingMgr::GetList().empty())
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(AsyncAuctionListingMgr::GetTempLock());
|
||||
|
||||
for (auto const& delayEvent: AsyncAuctionListingMgr::GetTempList())
|
||||
AsyncAuctionListingMgr::GetList().emplace_back(delayEvent);
|
||||
|
||||
AsyncAuctionListingMgr::GetTempList().clear();
|
||||
}
|
||||
|
||||
for (auto& itr: AsyncAuctionListingMgr::GetList())
|
||||
{
|
||||
if (itr._pickupTimer <= diff)
|
||||
{
|
||||
itr._pickupTimer = Milliseconds::zero();
|
||||
}
|
||||
else
|
||||
{
|
||||
itr._pickupTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto itr = AsyncAuctionListingMgr::GetList().begin(); itr != AsyncAuctionListingMgr::GetList().end(); ++itr)
|
||||
{
|
||||
if ((*itr)._pickupTimer != Milliseconds::zero())
|
||||
continue;
|
||||
|
||||
if ((*itr).Execute())
|
||||
AsyncAuctionListingMgr::GetList().erase(itr);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
LOG_INFO("server", "Auction House Listing thread exiting without problems.");
|
||||
}
|
||||
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& configService)
|
||||
{
|
||||
options_description all("Allowed options");
|
||||
|
||||
Reference in New Issue
Block a user