mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
Some changes to tic rates and default values
This commit is contained in:
parent
73dc6b090b
commit
310d27c0bd
@ -233,7 +233,7 @@ void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr,
|
||||
{
|
||||
DaybreakDisconnect header;
|
||||
header.zero = 0;
|
||||
header.opcode = OP_SessionDisconnect;
|
||||
header.opcode = OP_OutOfSession;
|
||||
header.connect_code = 0;
|
||||
|
||||
DynamicPacket out;
|
||||
@ -733,7 +733,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
response.zero = 0;
|
||||
response.opcode = OP_SessionStatResponse;
|
||||
response.timestamp = request.timestamp;
|
||||
response.our_timestamp = EQ::Net::HostToNetwork(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
|
||||
response.our_timestamp = EQ::Net::HostToNetwork(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
response.client_sent = request.packets_sent;
|
||||
response.client_recv = request.packets_recv;
|
||||
response.server_sent = EQ::Net::HostToNetwork(m_stats.sent_packets);
|
||||
@ -742,7 +742,9 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
out.PutSerialize(0, response);
|
||||
InternalSend(out);
|
||||
|
||||
m_resend_delay = std::min((size_t)(request.avg_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms, m_owner->m_options.resend_delay_max);
|
||||
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:
|
||||
@ -1000,6 +1002,10 @@ void EQ::Net::DaybreakConnection::ProcessResend()
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
{
|
||||
if (m_status == DbProtocolStatus::StatusDisconnected || m_status == DbProtocolStatus::StatusDisconnecting) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto now = Clock::now();
|
||||
auto s = &m_streams[stream];
|
||||
for (auto &entry : s->sent_packets) {
|
||||
@ -1012,6 +1018,13 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (entry.second.times_resent >= m_owner->m_options.max_resend_count) {
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
auto adjusted_resend = std::max((uint32_t)(m_resend_delay / (entry.second.times_resent + 1)), (uint32_t)m_owner->m_options.resend_delay_min);
|
||||
|
||||
if ((size_t)time_since_last_send.count() > m_resend_delay) {
|
||||
InternalBufferedSend(entry.second.packet);
|
||||
entry.second.last_sent = now;
|
||||
|
||||
@ -68,8 +68,8 @@ namespace EQ
|
||||
SequencePast
|
||||
};
|
||||
|
||||
typedef std::chrono::system_clock::time_point Timestamp;
|
||||
typedef std::chrono::system_clock Clock;
|
||||
typedef std::chrono::high_resolution_clock::time_point Timestamp;
|
||||
typedef std::chrono::high_resolution_clock Clock;
|
||||
|
||||
struct DaybreakConnectionStats
|
||||
{
|
||||
@ -209,7 +209,8 @@ namespace EQ
|
||||
keepalive_delay_ms = 9000;
|
||||
resend_delay_ms = 300;
|
||||
resend_delay_factor = 1.5;
|
||||
resend_delay_max = 5000;
|
||||
resend_delay_min = 50;
|
||||
resend_delay_max = 2000;
|
||||
connect_delay_ms = 500;
|
||||
stale_connection_ms = 60000;
|
||||
connect_stale_ms = 5000;
|
||||
@ -222,7 +223,8 @@ namespace EQ
|
||||
hold_length_ms = 10;
|
||||
simulated_in_packet_loss = 0;
|
||||
simulated_out_packet_loss = 0;
|
||||
tic_rate_hertz = 10.0;
|
||||
tic_rate_hertz = 60.0;
|
||||
max_resend_count = 10;
|
||||
}
|
||||
|
||||
size_t max_packet_size;
|
||||
@ -230,6 +232,7 @@ namespace EQ
|
||||
size_t keepalive_delay_ms;
|
||||
double resend_delay_factor;
|
||||
size_t resend_delay_ms;
|
||||
size_t resend_delay_min;
|
||||
size_t resend_delay_max;
|
||||
size_t connect_delay_ms;
|
||||
size_t connect_stale_ms;
|
||||
@ -240,6 +243,7 @@ namespace EQ
|
||||
size_t simulated_in_packet_loss;
|
||||
size_t simulated_out_packet_loss;
|
||||
double tic_rate_hertz;
|
||||
size_t max_resend_count;
|
||||
DaybreakEncodeType encode_passes[2];
|
||||
int port;
|
||||
};
|
||||
|
||||
@ -45,10 +45,6 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnec
|
||||
std::unique_ptr<EQ::Net::Packet> t(new EQ::Net::DynamicPacket());
|
||||
t->PutPacket(0, p);
|
||||
stream->m_packet_queue.push_back(std::move(t));
|
||||
|
||||
if (m_on_data_avail) {
|
||||
m_on_data_avail(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,14 +47,11 @@ namespace EQ
|
||||
|
||||
void OnNewConnection(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_new_connection = func; }
|
||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||
void OnDataAvailable(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_data_avail = func; }
|
||||
|
||||
private:
|
||||
EQStreamManagerOptions m_options;
|
||||
DaybreakConnectionManager m_daybreak;
|
||||
std::function<void(std::shared_ptr<EQStream>)> m_on_new_connection;
|
||||
std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||
std::function<void(std::shared_ptr<EQStream>)> m_on_data_avail;
|
||||
std::map<std::shared_ptr<DaybreakConnection>, std::shared_ptr<EQStream>> m_streams;
|
||||
|
||||
void DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection);
|
||||
|
||||
17
zone/net.cpp
17
zone/net.cpp
@ -431,15 +431,11 @@ int main(int argc, char** argv) {
|
||||
bool worldwasconnected = worldserver.Connected();
|
||||
std::shared_ptr<EQStreamInterface> eqss;
|
||||
EQStreamInterface *eqsi;
|
||||
uint8 IDLEZONEUPDATE = 200;
|
||||
uint8 ZONEUPDATE = 10;
|
||||
Timer zoneupdate_timer(ZONEUPDATE);
|
||||
zoneupdate_timer.Start();
|
||||
bool eqsf_open = false;
|
||||
std::unique_ptr<EQ::Net::EQStreamManager> eqsm;
|
||||
std::chrono::time_point<std::chrono::system_clock> frame_prev = std::chrono::system_clock::now();
|
||||
|
||||
EQ::Timer process_timer(50, true, [&](EQ::Timer* t) {
|
||||
EQ::Timer process_timer(15, true, [&](EQ::Timer* t) {
|
||||
//Advance the timer to our current point in time
|
||||
Timer::SetCurrentTime();
|
||||
|
||||
@ -474,14 +470,6 @@ int main(int argc, char** argv) {
|
||||
entity_list.AddClient(client);
|
||||
}
|
||||
|
||||
if ( numclients < 1 && zoneupdate_timer.GetDuration() != IDLEZONEUPDATE )
|
||||
zoneupdate_timer.SetTimer(IDLEZONEUPDATE);
|
||||
else if ( numclients > 0 && zoneupdate_timer.GetDuration() == IDLEZONEUPDATE )
|
||||
{
|
||||
zoneupdate_timer.SetTimer(ZONEUPDATE);
|
||||
zoneupdate_timer.Trigger();
|
||||
}
|
||||
|
||||
if (worldserver.Connected()) {
|
||||
worldwasconnected = true;
|
||||
}
|
||||
@ -491,7 +479,7 @@ int main(int argc, char** argv) {
|
||||
worldwasconnected = false;
|
||||
}
|
||||
|
||||
if (is_zone_loaded && zoneupdate_timer.Check()) {
|
||||
if (is_zone_loaded) {
|
||||
{
|
||||
if(net.group_timer.Enabled() && net.group_timer.Check())
|
||||
entity_list.GroupProcess();
|
||||
@ -527,6 +515,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (InterserverTimer.Check()) {
|
||||
InterserverTimer.Start();
|
||||
database.ping();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user