diff --git a/world/zonelist.cpp b/world/zonelist.cpp index d86f727f6..db831e941 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -43,6 +43,7 @@ ZSList::ZSList() memset(pLockedZones, 0, sizeof(pLockedZones)); m_tick.reset(new EQ::Timer(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1))); + m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&ZSList::OnKeepAlive, this, std::placeholders::_1))); } ZSList::~ZSList() { @@ -745,4 +746,11 @@ void ZSList::OnTick(EQ::Timer *t) } web_interface.SendEvent(out); -} \ No newline at end of file +} + +void ZSList::OnKeepAlive(EQ::Timer *t) +{ + for (auto &zone : list) { + zone->SendKeepAlive(); + } +} diff --git a/world/zonelist.h b/world/zonelist.h index 9911b87e0..c63e1686b 100644 --- a/world/zonelist.h +++ b/world/zonelist.h @@ -63,6 +63,7 @@ public: private: void OnTick(EQ::Timer *t); + void OnKeepAlive(EQ::Timer *t); uint32 NextID; std::list> list; uint16 pLockedZones[MaxLockedZones]; @@ -70,6 +71,7 @@ private: uint16 LastAllocatedPort; std::unique_ptr m_tick; + std::unique_ptr m_keepalive; }; #endif /*ZONELIST_H_*/ diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index e685b280e..263aeee2f 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -1400,6 +1400,13 @@ void ZoneServer::SendGroupIDs() { delete pack; } + +void ZoneServer::SendKeepAlive() +{ + ServerPacket pack(ServerOP_KeepAlive, 0); + SendPacket(&pack); +} + void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) { auto pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct)); ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*)pack->pBuffer; diff --git a/world/zoneserver.h b/world/zoneserver.h index 1f9e9516c..f5d7296df 100644 --- a/world/zoneserver.h +++ b/world/zoneserver.h @@ -39,6 +39,7 @@ public: void SendPacket(ServerPacket* pack) { tcpc->SendPacket(pack); } void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...); void SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message); + void SendKeepAlive(); bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false); void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false); void Disconnect() { auto handle = tcpc->Handle(); if (handle) { handle->Disconnect(); } }