mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 16:28:28 +00:00
[Network] Prune / disconnect TCP connections gracefully (#4574)
This commit is contained in:
@@ -595,11 +595,6 @@ bool LoginServer::Connect()
|
||||
);
|
||||
}
|
||||
|
||||
m_keepalive = std::make_unique<EQ::Timer>(
|
||||
1000,
|
||||
true,
|
||||
std::bind(&LoginServer::OnKeepAlive, this, std::placeholders::_1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -716,8 +711,3 @@ void LoginServer::SendAccountUpdate(ServerPacket *pack)
|
||||
}
|
||||
}
|
||||
|
||||
void LoginServer::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
SendPacket(&pack);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ private:
|
||||
void ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p);
|
||||
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||
|
||||
std::unique_ptr<EQ::Net::ServertalkClient> m_client;
|
||||
|
||||
@@ -22,7 +22,6 @@ void QueryServConnection::AddConnection(std::shared_ptr<EQ::Net::ServertalkServe
|
||||
connection->OnMessage(ServerOP_QueryServGeneric, std::bind(&QueryServConnection::HandleGenericMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
connection->OnMessage(ServerOP_LFGuildUpdate, std::bind(&QueryServConnection::HandleLFGuildUpdateMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_streams.emplace(std::make_pair(connection->GetUUID(), connection));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&QueryServConnection::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void QueryServConnection::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
|
||||
@@ -54,8 +53,3 @@ bool QueryServConnection::SendPacket(ServerPacket* pack)
|
||||
return true;
|
||||
}
|
||||
|
||||
void QueryServConnection::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
SendPacket(&pack);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ public:
|
||||
void HandleGenericMessage(uint16_t opcode, EQ::Net::Packet &p);
|
||||
void HandleLFGuildUpdateMessage(uint16_t opcode, EQ::Net::Packet &p);
|
||||
bool SendPacket(ServerPacket* pack);
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
private:
|
||||
std::map<std::string, std::shared_ptr<EQ::Net::ServertalkServerConnection>> m_streams;
|
||||
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||
|
||||
@@ -31,8 +31,6 @@ void UCSConnection::SetConnection(std::shared_ptr<EQ::Net::ServertalkServerConne
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&UCSConnection::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
const std::shared_ptr<EQ::Net::ServertalkServerConnection> &UCSConnection::GetConnection() const
|
||||
@@ -92,13 +90,3 @@ void UCSConnection::SendMessage(const char *From, const char *Message)
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void UCSConnection::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
if (!connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
connection->SendPacket(&pack);
|
||||
}
|
||||
|
||||
@@ -23,11 +23,6 @@ private:
|
||||
inline std::string GetIP() const { return (connection && connection->Handle()) ? connection->Handle()->RemoteIP() : 0; }
|
||||
std::shared_ptr<EQ::Net::ServertalkServerConnection> connection;
|
||||
|
||||
/**
|
||||
* Keepalive
|
||||
*/
|
||||
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
};
|
||||
|
||||
#endif /*UCS_H_*/
|
||||
|
||||
@@ -42,7 +42,6 @@ ZSList::ZSList()
|
||||
memset(pLockedZones, 0, sizeof(pLockedZones));
|
||||
|
||||
m_tick = std::make_unique<EQ::Timer>(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&ZSList::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
ZSList::~ZSList() {
|
||||
@@ -846,13 +845,6 @@ void ZSList::OnTick(EQ::Timer *t)
|
||||
web_interface.SendEvent(out);
|
||||
}
|
||||
|
||||
void ZSList::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
for (auto &zone : zone_server_list) {
|
||||
zone->SendKeepAlive();
|
||||
}
|
||||
}
|
||||
|
||||
const std::list<std::unique_ptr<ZoneServer>> &ZSList::getZoneServerList() const
|
||||
{
|
||||
return zone_server_list;
|
||||
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
|
||||
private:
|
||||
void OnTick(EQ::Timer *t);
|
||||
void OnKeepAlive(EQ::Timer *t);
|
||||
uint32 NextID;
|
||||
uint16 pLockedZones[MaxLockedZones];
|
||||
uint32 CurGroupID;
|
||||
|
||||
Reference in New Issue
Block a user