mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-08 14:12:27 +00:00
Add keepalives for world > login and login > world
This commit is contained in:
parent
4b61d00dfe
commit
1bfbe51d89
@ -71,6 +71,8 @@ WorldServer::WorldServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> wo
|
|||||||
ServerOP_LSAccountUpdate,
|
ServerOP_LSAccountUpdate,
|
||||||
std::bind(&WorldServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2)
|
std::bind(&WorldServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
m_keepalive.reset(new EQ::Timer(5000, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldServer::~WorldServer() = default;
|
WorldServer::~WorldServer() = default;
|
||||||
@ -1231,3 +1233,9 @@ const std::string &WorldServer::GetVersion() const
|
|||||||
{
|
{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldServer::OnKeepAlive(EQ::Timer *t)
|
||||||
|
{
|
||||||
|
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||||
|
connection->SendPacket(&pack);
|
||||||
|
}
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
#include "../common/packet_dump.h"
|
#include "../common/packet_dump.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
#include "../common/event/timer.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -180,6 +181,13 @@ private:
|
|||||||
bool is_server_logged_in;
|
bool is_server_logged_in;
|
||||||
bool is_server_trusted;
|
bool is_server_trusted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keepalive
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
|
void OnKeepAlive(EQ::Timer *t);
|
||||||
|
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -446,7 +446,6 @@ bool LoginServer::Connect()
|
|||||||
std::placeholders::_2
|
std::placeholders::_2
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
client.reset(new EQ::Net::ServertalkClient(LoginServerAddress, LoginServerPort, false, "World", ""));
|
client.reset(new EQ::Net::ServertalkClient(LoginServerAddress, LoginServerPort, false, "World", ""));
|
||||||
@ -553,6 +552,8 @@ bool LoginServer::Connect()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_keepalive.reset(new EQ::Timer(5000, true, std::bind(&LoginServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,3 +644,9 @@ void LoginServer::SendAccountUpdate(ServerPacket *pack)
|
|||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoginServer::OnKeepAlive(EQ::Timer *t)
|
||||||
|
{
|
||||||
|
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||||
|
SendPacket(&pack);
|
||||||
|
}
|
||||||
@ -53,6 +53,9 @@ private:
|
|||||||
void ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p);
|
void ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p);
|
||||||
void ProcessLSAccountUpdate(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> client;
|
std::unique_ptr<EQ::Net::ServertalkClient> client;
|
||||||
std::unique_ptr<EQ::Net::ServertalkLegacyClient> legacy_client;
|
std::unique_ptr<EQ::Net::ServertalkLegacyClient> legacy_client;
|
||||||
std::unique_ptr<EQ::Timer> statusupdate_timer;
|
std::unique_ptr<EQ::Timer> statusupdate_timer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user