mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-07 21:32:26 +00:00
Some changes to resend logic and default values
This commit is contained in:
parent
a24dfd35e8
commit
d20ea3852c
@ -278,7 +278,6 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
|||||||
m_hold_time = Clock::now();
|
m_hold_time = Clock::now();
|
||||||
m_buffered_packets_length = 0;
|
m_buffered_packets_length = 0;
|
||||||
m_rolling_ping = 500;
|
m_rolling_ping = 500;
|
||||||
m_resend_delay = (m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
|
||||||
m_combined.reset(new char[512]);
|
m_combined.reset(new char[512]);
|
||||||
m_combined[0] = 0;
|
m_combined[0] = 0;
|
||||||
m_combined[1] = OP_Combined;
|
m_combined[1] = OP_Combined;
|
||||||
@ -301,7 +300,6 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
|||||||
m_hold_time = Clock::now();
|
m_hold_time = Clock::now();
|
||||||
m_buffered_packets_length = 0;
|
m_buffered_packets_length = 0;
|
||||||
m_rolling_ping = 500;
|
m_rolling_ping = 500;
|
||||||
m_resend_delay = (m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
|
||||||
m_combined.reset(new char[512]);
|
m_combined.reset(new char[512]);
|
||||||
m_combined[0] = 0;
|
m_combined[0] = 0;
|
||||||
m_combined[1] = OP_Combined;
|
m_combined[1] = OP_Combined;
|
||||||
@ -356,9 +354,6 @@ void EQ::Net::DaybreakConnection::ResetStats()
|
|||||||
void EQ::Net::DaybreakConnection::Process()
|
void EQ::Net::DaybreakConnection::Process()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
m_resend_delay = (size_t)(m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
|
||||||
m_resend_delay = EQEmu::Clamp(m_resend_delay, m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_max);
|
|
||||||
|
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
auto time_since_hold = (size_t)std::chrono::duration_cast<std::chrono::milliseconds>(now - m_hold_time).count();
|
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) {
|
if (time_since_hold >= m_owner->m_options.hold_length_ms) {
|
||||||
@ -1026,11 +1021,11 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
for (auto &entry : s->sent_packets) {
|
for (auto &entry : s->sent_packets) {
|
||||||
auto time_since_last_send = std::chrono::duration_cast<std::chrono::milliseconds>(now - entry.second.last_sent);
|
auto time_since_last_send = std::chrono::duration_cast<std::chrono::milliseconds>(now - entry.second.last_sent);
|
||||||
if (entry.second.times_resent == 0) {
|
if (entry.second.times_resent == 0) {
|
||||||
if ((size_t)time_since_last_send.count() > m_resend_delay) {
|
if ((size_t)time_since_last_send.count() > entry.second.resend_delay) {
|
||||||
InternalBufferedSend(entry.second.packet);
|
InternalBufferedSend(entry.second.packet);
|
||||||
entry.second.last_sent = now;
|
entry.second.last_sent = now;
|
||||||
entry.second.times_resent++;
|
entry.second.times_resent++;
|
||||||
m_rolling_ping += 100;
|
entry.second.resend_delay = EQEmu::Clamp(entry.second.resend_delay * 2, m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1040,11 +1035,11 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)time_since_last_send.count() > m_resend_delay) {
|
if ((size_t)time_since_last_send.count() > entry.second.resend_delay) {
|
||||||
InternalBufferedSend(entry.second.packet);
|
InternalBufferedSend(entry.second.packet);
|
||||||
entry.second.last_sent = now;
|
entry.second.last_sent = now;
|
||||||
entry.second.times_resent++;
|
entry.second.times_resent++;
|
||||||
m_rolling_ping += 100;
|
entry.second.resend_delay = EQEmu::Clamp(entry.second.resend_delay * 2, m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1294,6 +1289,10 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
sent.times_resent = 0;
|
sent.times_resent = 0;
|
||||||
|
sent.resend_delay = EQEmu::Clamp(
|
||||||
|
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
|
||||||
|
m_owner->m_options.resend_delay_min,
|
||||||
|
m_owner->m_options.resend_delay_max);
|
||||||
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
||||||
stream->sequence_out++;
|
stream->sequence_out++;
|
||||||
|
|
||||||
@ -1322,6 +1321,10 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
sent.times_resent = 0;
|
sent.times_resent = 0;
|
||||||
|
sent.resend_delay = EQEmu::Clamp(
|
||||||
|
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
|
||||||
|
m_owner->m_options.resend_delay_min,
|
||||||
|
m_owner->m_options.resend_delay_max);
|
||||||
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
||||||
stream->sequence_out++;
|
stream->sequence_out++;
|
||||||
|
|
||||||
@ -1342,6 +1345,10 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
sent.times_resent = 0;
|
sent.times_resent = 0;
|
||||||
|
sent.resend_delay = EQEmu::Clamp(
|
||||||
|
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
|
||||||
|
m_owner->m_options.resend_delay_min,
|
||||||
|
m_owner->m_options.resend_delay_max);
|
||||||
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent));
|
||||||
stream->sequence_out++;
|
stream->sequence_out++;
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,6 @@ namespace EQ
|
|||||||
std::unique_ptr<char[]> m_combined;
|
std::unique_ptr<char[]> m_combined;
|
||||||
DaybreakConnectionStats m_stats;
|
DaybreakConnectionStats m_stats;
|
||||||
Timestamp m_last_session_stats;
|
Timestamp m_last_session_stats;
|
||||||
size_t m_resend_delay;
|
|
||||||
size_t m_rolling_ping;
|
size_t m_rolling_ping;
|
||||||
Timestamp m_close_time;
|
Timestamp m_close_time;
|
||||||
|
|
||||||
@ -142,6 +141,7 @@ namespace EQ
|
|||||||
Timestamp last_sent;
|
Timestamp last_sent;
|
||||||
Timestamp first_sent;
|
Timestamp first_sent;
|
||||||
size_t times_resent;
|
size_t times_resent;
|
||||||
|
size_t resend_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakStream
|
struct DaybreakStream
|
||||||
@ -205,10 +205,10 @@ namespace EQ
|
|||||||
DaybreakConnectionManagerOptions() {
|
DaybreakConnectionManagerOptions() {
|
||||||
max_connection_count = 0;
|
max_connection_count = 0;
|
||||||
keepalive_delay_ms = 9000;
|
keepalive_delay_ms = 9000;
|
||||||
resend_delay_ms = 150;
|
resend_delay_ms = 30;
|
||||||
resend_delay_factor = 1.5;
|
resend_delay_factor = 1.25;
|
||||||
resend_delay_min = 150;
|
resend_delay_min = 150;
|
||||||
resend_delay_max = 1000;
|
resend_delay_max = 3000;
|
||||||
connect_delay_ms = 500;
|
connect_delay_ms = 500;
|
||||||
stale_connection_ms = 90000;
|
stale_connection_ms = 90000;
|
||||||
connect_stale_ms = 5000;
|
connect_stale_ms = 5000;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user