mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[World] Fix Rarer Reload Deadlock (#4893)
This commit is contained in:
parent
a56bb52808
commit
c7a463420b
@ -162,7 +162,8 @@ void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::str
|
||||
for (auto &t: ServerReload::GetTypes()) {
|
||||
if (std::to_string(t) == command || Strings::ToLower(ServerReload::GetName(t)) == command) {
|
||||
message(r, fmt::format("Reloading [{}] globally", ServerReload::GetName(t)));
|
||||
zoneserver_list.SendServerReload(t, nullptr);
|
||||
LogInfo("Queueing reload of type [{}] to zones", ServerReload::GetName(t));
|
||||
zoneserver_list.QueueServerReload(t);
|
||||
}
|
||||
found_command = true;
|
||||
}
|
||||
|
||||
@ -132,6 +132,16 @@ void ZSList::Process() {
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
if (!m_queued_reloads.empty()) {
|
||||
m_queued_reloads_mutex.lock();
|
||||
for (auto &type : m_queued_reloads) {
|
||||
LogInfo("Sending reload of type [{}] to zones", ServerReload::GetName(type));
|
||||
SendServerReload(type, nullptr);
|
||||
}
|
||||
m_queued_reloads.clear();
|
||||
m_queued_reloads_mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool ZSList::SendPacket(ServerPacket* pack) {
|
||||
@ -1003,3 +1013,10 @@ void ZSList::SendServerReload(ServerReload::Type type, uchar *packet)
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
||||
void ZSList::QueueServerReload(ServerReload::Type &type)
|
||||
{
|
||||
m_queued_reloads_mutex.lock();
|
||||
m_queued_reloads.emplace_back(type);
|
||||
m_queued_reloads_mutex.unlock();
|
||||
}
|
||||
|
||||
@ -74,7 +74,10 @@ public:
|
||||
const std::list<std::unique_ptr<ZoneServer>> &getZoneServerList() const;
|
||||
inline uint32_t GetServerListCount() { return zone_server_list.size(); }
|
||||
void SendServerReload(ServerReload::Type type, uchar *packet = nullptr);
|
||||
std::mutex m_queued_reloads_mutex;
|
||||
std::vector<ServerReload::Type> m_queued_reloads = {};
|
||||
|
||||
void QueueServerReload(ServerReload::Type &type);
|
||||
private:
|
||||
void OnTick(EQ::Timer *t);
|
||||
uint32 NextID;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user