Count duplicate packets as congestion indicator

This commit is contained in:
sfan5 2024-08-30 15:39:43 +02:00
parent af67353f7a
commit 9c2b2c002c

@ -739,16 +739,16 @@ void Channel::UpdateTimers(float dtime)
if (packet_loss_counter > 1.0f) { if (packet_loss_counter > 1.0f) {
packet_loss_counter -= 1.0f; packet_loss_counter -= 1.0f;
unsigned int packet_loss = 11; /* use a neutral value for initialization */ unsigned int packet_loss;
unsigned int packets_successful = 0; unsigned int packets_successful;
//unsigned int packet_too_late = 0; unsigned int packet_too_late;
bool reasonable_amount_of_data_transmitted = false; bool reasonable_amount_of_data_transmitted = false;
{ {
MutexAutoLock internal(m_internal_mutex); MutexAutoLock internal(m_internal_mutex);
packet_loss = current_packet_loss; packet_loss = current_packet_loss;
//packet_too_late = current_packet_too_late; packet_too_late = current_packet_too_late;
packets_successful = current_packet_successful; packets_successful = current_packet_successful;
if (current_bytes_transfered > (unsigned int) (m_window_size*512/2)) { if (current_bytes_transfered > (unsigned int) (m_window_size*512/2)) {
@ -759,6 +759,11 @@ void Channel::UpdateTimers(float dtime)
current_packet_successful = 0; current_packet_successful = 0;
} }
// Packets too late means either packet duplication along the way
// or we were too fast in resending it (which should be self-regulating).
// Count this a signal of congestion, like packet loss.
packet_loss = std::min(packet_loss + packet_too_late, packets_successful);
/* dynamic window size */ /* dynamic window size */
float successful_to_lost_ratio = 0.0f; float successful_to_lost_ratio = 0.0f;
bool done = false; bool done = false;