Some tweaks

This commit is contained in:
KimLS 2017-07-03 21:31:25 -07:00
parent 15606a99fc
commit c6bb4a6470
2 changed files with 7 additions and 25 deletions

View File

@ -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() void EQ::Net::DaybreakConnection::IncreaseCongestionWindow()
{ {
if (!CongestionWindowFull()) {
return;
}
if (m_cwnd < m_ssthresh) { if (m_cwnd < m_ssthresh) {
m_cwnd += m_cwnd; m_cwnd += m_max_packet_size;
} }
else { 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); 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() 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; m_ssthresh = m_cwnd;
LogF(Logs::Detail, Logs::Netcode, "Reducing cwnd size new size is {0}", m_cwnd); LogF(Logs::Detail, Logs::Netcode, "Reducing cwnd size new size is {0}", m_cwnd);
} }

View File

@ -182,7 +182,6 @@ namespace EQ
void ProcessPacket(Packet &p); void ProcessPacket(Packet &p);
void ProcessInboundQueue(); void ProcessInboundQueue();
void ProcessOutboundQueue(); void ProcessOutboundQueue();
bool CongestionWindowFull() const;
void IncreaseCongestionWindow(); void IncreaseCongestionWindow();
void ReduceCongestionWindow(); void ReduceCongestionWindow();
void RemoveFromQueue(int stream, uint16_t seq); void RemoveFromQueue(int stream, uint16_t seq);
@ -224,7 +223,7 @@ namespace EQ
resend_delay_ms = 150; resend_delay_ms = 150;
resend_delay_factor = 1.25; resend_delay_factor = 1.25;
resend_delay_min = 500; resend_delay_min = 500;
resend_delay_max = 4000; resend_delay_max = 5000;
connect_delay_ms = 500; connect_delay_ms = 500;
stale_connection_ms = 90000; stale_connection_ms = 90000;
connect_stale_ms = 5000; connect_stale_ms = 5000;
@ -234,13 +233,13 @@ namespace EQ
encode_passes[1] = DaybreakEncodeType::EncodeNone; encode_passes[1] = DaybreakEncodeType::EncodeNone;
port = 0; port = 0;
hold_size = 448; hold_size = 448;
hold_length_ms = 10; hold_length_ms = 40;
simulated_in_packet_loss = 0; simulated_in_packet_loss = 0;
simulated_out_packet_loss = 0; simulated_out_packet_loss = 0;
tic_rate_hertz = 60.0; tic_rate_hertz = 60.0;
resend_timeout = 90000; resend_timeout = 90000;
connection_close_time = 2000; connection_close_time = 2000;
max_outstanding_bytes = 204800; max_outstanding_bytes = 48000;
} }
size_t max_packet_size; size_t max_packet_size;