Keep alive implemented for world->zone

This commit is contained in:
KimLS 2018-07-07 22:19:24 -07:00
parent d2683022e1
commit 5060de9b58
4 changed files with 19 additions and 1 deletions

View File

@ -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);
}
}
void ZSList::OnKeepAlive(EQ::Timer *t)
{
for (auto &zone : list) {
zone->SendKeepAlive();
}
}

View File

@ -63,6 +63,7 @@ public:
private:
void OnTick(EQ::Timer *t);
void OnKeepAlive(EQ::Timer *t);
uint32 NextID;
std::list<std::unique_ptr<ZoneServer>> list;
uint16 pLockedZones[MaxLockedZones];
@ -70,6 +71,7 @@ private:
uint16 LastAllocatedPort;
std::unique_ptr<EQ::Timer> m_tick;
std::unique_ptr<EQ::Timer> m_keepalive;
};
#endif /*ZONELIST_H_*/

View File

@ -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;

View File

@ -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(); } }