mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Added keep alive to relay link for backwards compat with emu_tcp_connection (they disconnect you after about 45 seconds if you don't send keep alives even if the tcp connection is fine...)
This commit is contained in:
parent
44b9c99781
commit
23120bcde6
@ -5,7 +5,8 @@
|
|||||||
#include "../servertalk.h"
|
#include "../servertalk.h"
|
||||||
|
|
||||||
EQ::Net::RelayLink::RelayLink(const std::string &addr, int port, const std::string &identifier, const std::string &password)
|
EQ::Net::RelayLink::RelayLink(const std::string &addr, int port, const std::string &identifier, const std::string &password)
|
||||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(250, true, std::bind(&EQ::Net::RelayLink::Connect, this))))
|
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(250, true, std::bind(&EQ::Net::RelayLink::Connect, this)))),
|
||||||
|
m_keepalive(std::unique_ptr<EQ::Timer>(new EQ::Timer(5000, true, std::bind(&EQ::Net::RelayLink::SendKeepAlive, this))))
|
||||||
{
|
{
|
||||||
m_established = false;
|
m_established = false;
|
||||||
m_connecting = false;
|
m_connecting = false;
|
||||||
@ -224,3 +225,12 @@ void EQ::Net::RelayLink::OnAuthFailed(const EQ::Net::Packet &p)
|
|||||||
m_connection->Disconnect();
|
m_connection->Disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EQ::Net::RelayLink::SendKeepAlive()
|
||||||
|
{
|
||||||
|
if (!m_connection)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EQ::Net::WritablePacket p;
|
||||||
|
SendPacket(0, p);
|
||||||
|
}
|
||||||
|
|||||||
@ -32,8 +32,10 @@ namespace EQ
|
|||||||
void SendInternal(const EQ::Net::Packet &p);
|
void SendInternal(const EQ::Net::Packet &p);
|
||||||
void SendPassword();
|
void SendPassword();
|
||||||
void OnAuthFailed(const EQ::Net::Packet &p);
|
void OnAuthFailed(const EQ::Net::Packet &p);
|
||||||
|
void SendKeepAlive();
|
||||||
|
|
||||||
std::unique_ptr<EQ::Timer> m_timer;
|
std::unique_ptr<EQ::Timer> m_timer;
|
||||||
|
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||||
std::string m_addr;
|
std::string m_addr;
|
||||||
std::string m_identifier;
|
std::string m_identifier;
|
||||||
std::string m_password;
|
std::string m_password;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ bool QueryServConnection::Process()
|
|||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetIP();
|
in.s_addr = GetIP();
|
||||||
Log.Out(Logs::Detail, Logs::QS_Server, "QueryServ authorization failed.");
|
Log.Out(Logs::General, Logs::QS_Server, "QueryServ authorization failed.");
|
||||||
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -82,6 +82,7 @@ bool QueryServConnection::Process()
|
|||||||
Log.Out(Logs::Detail, Logs::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
Log.Out(Logs::Detail, Logs::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
||||||
authenticated = true;
|
authenticated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pack;
|
delete pack;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user