From 4cd49d7eca5f8fd53eb98577a1f218a5086704bb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 5 Apr 2021 01:38:43 +0100 Subject: Fix sending incorrect date values on world change Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge. --- src/DeadlockDetect.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/DeadlockDetect.cpp') diff --git a/src/DeadlockDetect.cpp b/src/DeadlockDetect.cpp index 3f47589d8..fc426d529 100644 --- a/src/DeadlockDetect.cpp +++ b/src/DeadlockDetect.cpp @@ -103,11 +103,10 @@ void cDeadlockDetect::Execute(void) { // Check the world ages: cRoot::Get()->ForEachWorld([=](cWorld & a_World) - { - CheckWorldAge(a_World.GetName(), a_World.GetWorldAge()); - return false; - } - ); + { + CheckWorldAge(a_World.GetName(), a_World.GetWorldAge()); + return false; + }); std::this_thread::sleep_for(std::chrono::milliseconds(CYCLE_MILLISECONDS)); } // while (should run) @@ -117,7 +116,7 @@ void cDeadlockDetect::Execute(void) -void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, Int64 a_Age) +void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, const cTickTimeLong a_Age) { m_WorldAges[a_WorldName].m_Age = a_Age; m_WorldAges[a_WorldName].m_NumCyclesSame = 0; @@ -127,7 +126,7 @@ void cDeadlockDetect::SetWorldAge(const AString & a_WorldName, Int64 a_Age) -void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age) +void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, const cTickTimeLong a_Age) { WorldAges::iterator itr = m_WorldAges.find(a_WorldName); if (itr == m_WorldAges.end()) @@ -157,14 +156,14 @@ void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age) -void cDeadlockDetect::DeadlockDetected(const AString & a_WorldName, Int64 a_WorldAge) +void cDeadlockDetect::DeadlockDetected(const AString & a_WorldName, const cTickTimeLong a_WorldAge) { LOGERROR("Deadlock detected: world %s has been stuck at age %lld. Aborting the server.", - a_WorldName.c_str(), static_cast(a_WorldAge) + a_WorldName.c_str(), static_cast(a_WorldAge.count()) ); ListTrackedCSs(); ASSERT(!"Deadlock detected"); - abort(); + std::abort(); } @@ -182,7 +181,3 @@ void cDeadlockDetect::ListTrackedCSs(void) ); } } - - - - -- cgit v1.2.3