Do not evaluate timers if the server is shutting down

This should fix issues with segfaults when the server is being
terminated that sometimes occur because things like NPC path traversal
keep running while the process is executing the signal handler.
This commit is contained in:
dongresource 2022-11-27 22:33:55 +01:00
parent 1ba0f5e14a
commit eb8e54c1f0
1 changed files with 4 additions and 0 deletions

View File

@ -115,6 +115,10 @@ void CNShardServer::kill() {
void CNShardServer::onStep() {
time_t currTime = getTime();
// do not evaluate timers if the server is shutting down
if (!active)
return;
for (TimerEvent& event : Timers) {
if (event.scheduledEvent == 0) {
// event hasn't been queued yet, go ahead and do that