From c6bb4a647076e5bb4d54588855cbdf6d63d4566d Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 3 Jul 2017 21:31:25 -0700 Subject: [PATCH] Some tweaks --- common/net/daybreak_connection.cpp | 25 ++++--------------------- common/net/daybreak_connection.h | 7 +++---- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index ab4790447..c8e8b1a6d 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -486,31 +486,14 @@ void EQ::Net::DaybreakConnection::ProcessOutboundQueue() } } -bool EQ::Net::DaybreakConnection::CongestionWindowFull() const -{ - for (int i = 0; i < 4; ++i) { - auto stream = &m_streams[i]; - - if (!stream->buffered_packets.empty()) { - //We had to buffer packets and we only do that if the window was full - return true; - } - } - - return false; -} - void EQ::Net::DaybreakConnection::IncreaseCongestionWindow() { - if (!CongestionWindowFull()) { - return; - } - if (m_cwnd < m_ssthresh) { - m_cwnd += m_cwnd; + m_cwnd += m_max_packet_size; } else { - m_cwnd += m_max_packet_size; + size_t denom = std::max(m_cwnd, (size_t)1U); + m_cwnd += std::max((size_t)(m_max_packet_size * m_max_packet_size / denom), (size_t)1U); } m_cwnd = EQEmu::Clamp(m_cwnd, (size_t)m_max_packet_size, m_owner->m_options.max_outstanding_bytes); @@ -519,7 +502,7 @@ void EQ::Net::DaybreakConnection::IncreaseCongestionWindow() void EQ::Net::DaybreakConnection::ReduceCongestionWindow() { - m_cwnd = EQEmu::Clamp(m_cwnd / 2, (size_t)m_max_packet_size, m_owner->m_options.max_outstanding_bytes); + m_cwnd = EQEmu::Clamp((size_t)m_max_packet_size, (size_t)m_max_packet_size, m_owner->m_options.max_outstanding_bytes); m_ssthresh = m_cwnd; LogF(Logs::Detail, Logs::Netcode, "Reducing cwnd size new size is {0}", m_cwnd); } diff --git a/common/net/daybreak_connection.h b/common/net/daybreak_connection.h index b190e7900..8cdbcb33a 100644 --- a/common/net/daybreak_connection.h +++ b/common/net/daybreak_connection.h @@ -182,7 +182,6 @@ namespace EQ void ProcessPacket(Packet &p); void ProcessInboundQueue(); void ProcessOutboundQueue(); - bool CongestionWindowFull() const; void IncreaseCongestionWindow(); void ReduceCongestionWindow(); void RemoveFromQueue(int stream, uint16_t seq); @@ -224,7 +223,7 @@ namespace EQ resend_delay_ms = 150; resend_delay_factor = 1.25; resend_delay_min = 500; - resend_delay_max = 4000; + resend_delay_max = 5000; connect_delay_ms = 500; stale_connection_ms = 90000; connect_stale_ms = 5000; @@ -234,13 +233,13 @@ namespace EQ encode_passes[1] = DaybreakEncodeType::EncodeNone; port = 0; hold_size = 448; - hold_length_ms = 10; + hold_length_ms = 40; simulated_in_packet_loss = 0; simulated_out_packet_loss = 0; tic_rate_hertz = 60.0; resend_timeout = 90000; connection_close_time = 2000; - max_outstanding_bytes = 204800; + max_outstanding_bytes = 48000; } size_t max_packet_size;