Implement Zone -> World keepalive so that Zone reconnects to world in the case of a world crash / reset

This commit is contained in:
Akkadius 2019-09-07 20:20:10 -05:00
parent 4cba9439b9
commit 4b61d00dfe
2 changed files with 12 additions and 1 deletions

View File

@ -85,6 +85,8 @@ void WorldServer::Connect()
});
m_connection->OnMessage(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)));
}
bool WorldServer::SendPacket(ServerPacket *pack)
@ -563,7 +565,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
ServerZoneDropClient_Struct* drop = (ServerZoneDropClient_Struct*)pack->pBuffer;
if (zone) {
zone->RemoveAuth(drop->lsid);
auto client = entity_list.GetClientByLSID(drop->lsid);
if (client) {
client->Kick("Dropped by world CLE subsystem");
@ -2352,3 +2354,9 @@ void WorldServer::RequestTellQueue(const char *who)
safe_delete(pack);
return;
}
void WorldServer::OnKeepAlive(EQ::Timer *t)
{
ServerPacket pack(ServerOP_KeepAlive, 0);
SendPacket(&pack);
}

View File

@ -72,7 +72,10 @@ private:
uint32 cur_groupid;
uint32 last_groupid;
void OnKeepAlive(EQ::Timer *t);
std::unique_ptr<EQ::Net::ServertalkClient> m_connection;
std::unique_ptr<EQ::Timer> m_keepalive;
};
#endif