[Code] ZSList Global to Singleton Cleanup (#4940)

* [Code] ZSList Global to Singleton Cleanup

* Final

* Post merge fixes

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
Alex King
2025-06-25 16:16:44 -04:00
committed by GitHub
parent 643ee56433
commit dc261bb203
24 changed files with 266 additions and 275 deletions
+14 -15
View File
@@ -93,7 +93,6 @@
ClientList client_list;
GroupLFPList LFPGroupList;
ZSList zoneserver_list;
LauncherList launcher_list;
volatile bool RunLoops = true;
uint32 numclients = 0;
@@ -173,7 +172,7 @@ int main(int argc, char **argv)
// global loads
LogInfo("Loading launcher list");
launcher_list.LoadList();
zoneserver_list.Init();
ZSList::Instance()->Init();
if (IpUtil::IsPortInUse(Config->WorldIP, Config->WorldTCPPort)) {
LogError("World port [{}] already in use", Config->WorldTCPPort);
@@ -207,7 +206,7 @@ int main(int argc, char **argv)
server_connection->OnConnectionIdentified(
"Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
numzones++;
zoneserver_list.Add(new ZoneServer(connection, console.get()));
ZSList::Instance()->Add(new ZoneServer(connection, console.get()));
LogInfo(
"New Zone Server connection from [{}] at [{}:{}] zone_count [{}]",
@@ -222,7 +221,7 @@ int main(int argc, char **argv)
server_connection->OnConnectionRemoved(
"Zone", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
numzones--;
zoneserver_list.Remove(connection->GetUUID());
ZSList::Instance()->Remove(connection->GetUUID());
LogInfo(
"Removed Zone Server connection from [{}] total zone_count [{}]",
@@ -290,7 +289,7 @@ int main(int argc, char **argv)
UCSConnection::Instance()->SetConnection(connection);
zoneserver_list.UpdateUCSServerAvailable();
ZSList::Instance()->UpdateUCSServerAvailable();
}
);
@@ -303,7 +302,7 @@ int main(int argc, char **argv)
if (ucs_connection->GetUUID() == connection->GetUUID()) {
LogInfo("Removing currently active UCS connection");
UCSConnection::Instance()->SetConnection(nullptr);
zoneserver_list.UpdateUCSServerAvailable(false);
ZSList::Instance()->UpdateUCSServerAvailable(false);
}
}
);
@@ -346,10 +345,10 @@ int main(int argc, char **argv)
//register all the patches we have avaliable with the stream identifier.
EQStreamIdentifier stream_identifier;
RegisterAllPatches(stream_identifier);
zoneserver_list.shutdowntimer = new Timer(60000);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder = new Timer(20000);
zoneserver_list.reminder->Disable();
ZSList::Instance()->shutdowntimer = new Timer(60000);
ZSList::Instance()->shutdowntimer->Disable();
ZSList::Instance()->reminder = new Timer(20000);
ZSList::Instance()->reminder->Disable();
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
InterserverTimer.Trigger();
uint8 ReconnectCounter = 100;
@@ -414,7 +413,7 @@ int main(int argc, char **argv)
}
}
WorldEventScheduler::Instance()->Process(&zoneserver_list);
WorldEventScheduler::Instance()->Process(ZSList::Instance());
client_list.Process();
guild_mgr.Process();
@@ -427,7 +426,7 @@ int main(int argc, char **argv)
);
auto out = std::make_unique<ServerPacket>(ServerOP_ParcelPrune);
zoneserver_list.SendPacketToBootedZones(out.get());
ZSList::Instance()->SendPacketToBootedZones(out.get());
database.PurgeCharacterParcels();
}
@@ -442,7 +441,7 @@ int main(int argc, char **argv)
if (EQTimeTimer.Check()) {
TimeOfDay_Struct tod{};
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(nullptr), &tod);
ZSList::Instance()->worldclock.GetCurrentEQTimeOfDay(time(nullptr), &tod);
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year)) {
LogEqTime("Failed to save eqtime");
}
@@ -457,7 +456,7 @@ int main(int argc, char **argv)
}
}
zoneserver_list.Process();
ZSList::Instance()->Process();
launcher_list.Process();
LFPGroupList.Process();
AdventureManager::Instance()->Process();
@@ -491,7 +490,7 @@ int main(int argc, char **argv)
LogInfo("World main loop completed");
LogInfo("Shutting down zone connections (if any)");
zoneserver_list.KillAll();
ZSList::Instance()->KillAll();
LogInfo("Zone (TCP) listener stopped");
LogInfo("Signaling HTTP service to stop");
EQEmuLogSys::Instance()->CloseFileLogs();