mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 06:32:23 +01:00
Count duplicate packets as congestion indicator
This commit is contained in:
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user