mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Console wip, change how we send acks back to some old behavior
This commit is contained in:
+23
-2
@@ -125,11 +125,24 @@ void EQEmuConfig::do_world(TiXmlElement *ele)
|
||||
if (text) {
|
||||
WorldTCPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("telnet");
|
||||
if (text && !strcasecmp(text, "enabled")) {
|
||||
}
|
||||
|
||||
sub_ele = ele->FirstChildElement("telnet");
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("ip");
|
||||
if (text) {
|
||||
TelnetIP = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
TelnetTCPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
TelnetEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the <http> element
|
||||
sub_ele = ele->FirstChildElement("http");
|
||||
if (sub_ele != nullptr) {
|
||||
@@ -390,6 +403,12 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
if (var_name == "WorldIP") {
|
||||
return (WorldIP);
|
||||
}
|
||||
if (var_name == "TelnetTCPPort") {
|
||||
return (itoa(TelnetTCPPort));
|
||||
}
|
||||
if (var_name == "TelnetIP") {
|
||||
return (TelnetIP);
|
||||
}
|
||||
if (var_name == "TelnetEnabled") {
|
||||
return (TelnetEnabled ? "true" : "false");
|
||||
}
|
||||
@@ -510,6 +529,8 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "Locked = " << Locked << std::endl;
|
||||
std::cout << "WorldTCPPort = " << WorldTCPPort << std::endl;
|
||||
std::cout << "WorldIP = " << WorldIP << std::endl;
|
||||
std::cout << "TelnetTCPPort = " << TelnetTCPPort << std::endl;
|
||||
std::cout << "TelnetIP = " << TelnetIP << std::endl;
|
||||
std::cout << "TelnetEnabled = " << TelnetEnabled << std::endl;
|
||||
std::cout << "WorldHTTPPort = " << WorldHTTPPort << std::endl;
|
||||
std::cout << "WorldHTTPMimeFile = " << WorldHTTPMimeFile << std::endl;
|
||||
|
||||
@@ -49,6 +49,8 @@ class EQEmuConfig : public XMLParser
|
||||
bool Locked;
|
||||
uint16 WorldTCPPort;
|
||||
std::string WorldIP;
|
||||
uint16 TelnetTCPPort;
|
||||
std::string TelnetIP;
|
||||
bool TelnetEnabled;
|
||||
int32 MaxClients;
|
||||
bool WorldHTTPEnabled;
|
||||
@@ -135,6 +137,7 @@ class EQEmuConfig : public XMLParser
|
||||
// World
|
||||
Locked = false;
|
||||
WorldTCPPort = 9000;
|
||||
TelnetTCPPort = 9001;
|
||||
TelnetEnabled = false;
|
||||
WorldHTTPEnabled = false;
|
||||
WorldHTTPPort = 9080;
|
||||
@@ -189,6 +192,7 @@ class EQEmuConfig : public XMLParser
|
||||
DefaultStatus = 0;
|
||||
// For where zones need to connect to.
|
||||
WorldIP = "127.0.0.1";
|
||||
TelnetIP = "127.0.0.1";
|
||||
// Dynamics to start
|
||||
//DynamicCount=5;
|
||||
MaxClients = -1;
|
||||
|
||||
@@ -119,6 +119,7 @@ void EQ::Net::DaybreakConnectionManager::Process()
|
||||
auto time_since_last_recv = std::chrono::duration_cast<std::chrono::milliseconds>(now - connection->m_last_recv);
|
||||
if ((size_t)time_since_last_recv.count() > m_options.connect_stale_ms) {
|
||||
iter = m_connections.erase(iter);
|
||||
Log(Logs::Detail, Logs::Netcode, "Disconnect reason: Connect Mode Timeout {0} > {1}", (size_t)time_since_last_recv.count(), m_options.connect_stale_ms);
|
||||
connection->ChangeStatus(StatusDisconnecting);
|
||||
continue;
|
||||
}
|
||||
@@ -127,6 +128,7 @@ void EQ::Net::DaybreakConnectionManager::Process()
|
||||
auto time_since_last_recv = std::chrono::duration_cast<std::chrono::milliseconds>(now - connection->m_last_recv);
|
||||
if ((size_t)time_since_last_recv.count() > m_options.stale_connection_ms) {
|
||||
iter = m_connections.erase(iter);
|
||||
Log(Logs::Detail, Logs::Netcode, "Disconnect reason: Time since last recv {0} > {1}", (size_t)time_since_last_recv.count(), m_options.stale_connection_ms);
|
||||
connection->ChangeStatus(StatusDisconnecting);
|
||||
continue;
|
||||
}
|
||||
@@ -276,7 +278,7 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
||||
m_encode_passes[1] = owner->m_options.encode_passes[1];
|
||||
m_hold_time = Clock::now();
|
||||
m_buffered_packets_length = 0;
|
||||
m_resend_delay = 500;
|
||||
m_resend_delay = m_owner->m_options.resend_delay_ms + 25;
|
||||
m_rolling_ping = 100;
|
||||
m_combined.reset(new char[512]);
|
||||
m_combined[0] = 0;
|
||||
@@ -299,7 +301,7 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
||||
m_crc_bytes = 0;
|
||||
m_hold_time = Clock::now();
|
||||
m_buffered_packets_length = 0;
|
||||
m_resend_delay = 500;
|
||||
m_resend_delay = m_resend_delay = m_owner->m_options.resend_delay_ms + 25;
|
||||
m_rolling_ping = 100;
|
||||
m_combined.reset(new char[512]);
|
||||
m_combined[0] = 0;
|
||||
@@ -318,6 +320,7 @@ void EQ::Net::DaybreakConnection::Close()
|
||||
SendDisconnect();
|
||||
|
||||
m_close_time = Clock::now();
|
||||
Log(Logs::Detail, Logs::Netcode, "Disconnect reason: Server Request");
|
||||
ChangeStatus(StatusDisconnecting);
|
||||
}
|
||||
else {
|
||||
@@ -355,6 +358,11 @@ void EQ::Net::DaybreakConnection::ResetStats()
|
||||
void EQ::Net::DaybreakConnection::Process()
|
||||
{
|
||||
try {
|
||||
m_resend_delay = (size_t)(m_stats.last_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
||||
if (m_resend_delay > 500) {
|
||||
m_resend_delay = 500;
|
||||
}
|
||||
|
||||
auto now = Clock::now();
|
||||
auto time_since_hold = (size_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - m_hold_time).count();
|
||||
if (time_since_hold >= m_owner->m_options.hold_length_ms) {
|
||||
@@ -719,6 +727,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
SendDisconnect();
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Disconnect reason: OP_SessionRequest from client.");
|
||||
ChangeStatus(StatusDisconnecting);
|
||||
break;
|
||||
}
|
||||
@@ -747,10 +756,6 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
DynamicPacket out;
|
||||
out.PutSerialize(0, response);
|
||||
InternalSend(out);
|
||||
|
||||
m_resend_delay = (size_t)(request.avg_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
||||
m_resend_delay = std::min(m_resend_delay, m_owner->m_options.resend_delay_max);
|
||||
m_resend_delay = std::max(m_resend_delay, m_owner->m_options.resend_delay_min);
|
||||
break;
|
||||
}
|
||||
case OP_SessionStatResponse:
|
||||
@@ -1051,7 +1056,7 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
||||
auto iter = s->sent_packets.begin();
|
||||
while (iter != s->sent_packets.end()) {
|
||||
if (iter->first <= seq) {
|
||||
uint64_t round_time = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - iter->second.first_sent).count();
|
||||
uint64_t round_time = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - iter->second.last_sent).count();
|
||||
m_stats.total_ping += round_time;
|
||||
m_stats.total_acks++;
|
||||
m_stats.max_ping = std::max(m_stats.max_ping, round_time);
|
||||
@@ -1072,7 +1077,7 @@ void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
|
||||
auto s = &m_streams[stream];
|
||||
auto iter = s->sent_packets.find(seq);
|
||||
if (iter != s->sent_packets.end()) {
|
||||
uint64_t round_time = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - iter->second.first_sent).count();
|
||||
uint64_t round_time = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - iter->second.last_sent).count();
|
||||
m_stats.total_ping += round_time;
|
||||
m_stats.total_acks++;
|
||||
m_stats.max_ping = std::max(m_stats.max_ping, round_time);
|
||||
|
||||
@@ -209,10 +209,10 @@ namespace EQ
|
||||
DaybreakConnectionManagerOptions() {
|
||||
max_connection_count = 0;
|
||||
keepalive_delay_ms = 9000;
|
||||
resend_delay_ms = 300;
|
||||
resend_delay_ms = 50;
|
||||
resend_delay_factor = 1.5;
|
||||
resend_delay_min = 50;
|
||||
resend_delay_max = 1000;
|
||||
resend_delay_max = 500;
|
||||
connect_delay_ms = 500;
|
||||
stale_connection_ms = 90000;
|
||||
connect_stale_ms = 5000;
|
||||
|
||||
Reference in New Issue
Block a user