mirror of
https://github.com/minetest/minetest.git
synced 2024-09-12 00:26:50 +02:00
Add congestion control settings to minetest.conf
This commit is contained in:
parent
7b6d642300
commit
ab45133ab4
@ -198,3 +198,8 @@
|
|||||||
#dedicated_server_step = 0.1
|
#dedicated_server_step = 0.1
|
||||||
# Can be set to true to disable shutting down on invalid world data
|
# Can be set to true to disable shutting down on invalid world data
|
||||||
#ignore_world_load_errors = false
|
#ignore_world_load_errors = false
|
||||||
|
# Congestion control parameters
|
||||||
|
# time in seconds, rate in ~500B packets
|
||||||
|
#congestion_control_aim_rtt = 0.2
|
||||||
|
#congestion_control_max_rate = 400
|
||||||
|
#congestion_control_min_rate = 10
|
||||||
|
@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "util/serialize.h"
|
#include "util/serialize.h"
|
||||||
#include "util/numeric.h"
|
#include "util/numeric.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
namespace con
|
namespace con
|
||||||
{
|
{
|
||||||
@ -466,7 +467,10 @@ Peer::Peer(u16 a_id, Address a_address):
|
|||||||
m_sendtime_accu(0),
|
m_sendtime_accu(0),
|
||||||
m_max_packets_per_second(10),
|
m_max_packets_per_second(10),
|
||||||
m_num_sent(0),
|
m_num_sent(0),
|
||||||
m_max_num_sent(0)
|
m_max_num_sent(0),
|
||||||
|
congestion_control_aim_rtt(0.2),
|
||||||
|
congestion_control_max_rate(400),
|
||||||
|
congestion_control_min_rate(10)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Peer::~Peer()
|
Peer::~Peer()
|
||||||
@ -477,15 +481,15 @@ void Peer::reportRTT(float rtt)
|
|||||||
{
|
{
|
||||||
if(rtt >= 0.0){
|
if(rtt >= 0.0){
|
||||||
if(rtt < 0.01){
|
if(rtt < 0.01){
|
||||||
if(m_max_packets_per_second < 400)
|
if(m_max_packets_per_second < congestion_control_max_rate)
|
||||||
m_max_packets_per_second += 10;
|
m_max_packets_per_second += 10;
|
||||||
} else if(rtt < 0.2){
|
} else if(rtt < congestion_control_aim_rtt){
|
||||||
if(m_max_packets_per_second < 100)
|
if(m_max_packets_per_second < congestion_control_max_rate)
|
||||||
m_max_packets_per_second += 2;
|
m_max_packets_per_second += 2;
|
||||||
} else {
|
} else {
|
||||||
m_max_packets_per_second *= 0.8;
|
m_max_packets_per_second *= 0.8;
|
||||||
if(m_max_packets_per_second < 10)
|
if(m_max_packets_per_second < congestion_control_min_rate)
|
||||||
m_max_packets_per_second = 10;
|
m_max_packets_per_second = congestion_control_min_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,12 +895,24 @@ void Connection::receive()
|
|||||||
|
|
||||||
void Connection::runTimeouts(float dtime)
|
void Connection::runTimeouts(float dtime)
|
||||||
{
|
{
|
||||||
|
float congestion_control_aim_rtt
|
||||||
|
= g_settings->getFloat("congestion_control_aim_rtt");
|
||||||
|
float congestion_control_max_rate
|
||||||
|
= g_settings->getFloat("congestion_control_max_rate");
|
||||||
|
float congestion_control_min_rate
|
||||||
|
= g_settings->getFloat("congestion_control_min_rate");
|
||||||
|
|
||||||
core::list<u16> timeouted_peers;
|
core::list<u16> timeouted_peers;
|
||||||
core::map<u16, Peer*>::Iterator j;
|
core::map<u16, Peer*>::Iterator j;
|
||||||
j = m_peers.getIterator();
|
j = m_peers.getIterator();
|
||||||
for(; j.atEnd() == false; j++)
|
for(; j.atEnd() == false; j++)
|
||||||
{
|
{
|
||||||
Peer *peer = j.getNode()->getValue();
|
Peer *peer = j.getNode()->getValue();
|
||||||
|
|
||||||
|
// Update congestion control values
|
||||||
|
peer->congestion_control_aim_rtt = congestion_control_aim_rtt;
|
||||||
|
peer->congestion_control_max_rate = congestion_control_max_rate;
|
||||||
|
peer->congestion_control_min_rate = congestion_control_min_rate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check peer timeout
|
Check peer timeout
|
||||||
|
@ -394,7 +394,11 @@ public:
|
|||||||
float m_max_packets_per_second;
|
float m_max_packets_per_second;
|
||||||
int m_num_sent;
|
int m_num_sent;
|
||||||
int m_max_num_sent;
|
int m_max_num_sent;
|
||||||
|
|
||||||
|
// Updated from configuration by Connection
|
||||||
|
float congestion_control_aim_rtt;
|
||||||
|
float congestion_control_max_rate;
|
||||||
|
float congestion_control_min_rate;
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,6 +106,11 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("sound_volume", "0.8");
|
settings->setDefault("sound_volume", "0.8");
|
||||||
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
|
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
|
||||||
|
|
||||||
|
settings->setDefault("mip_map", "false");
|
||||||
|
settings->setDefault("anisotropic_filter", "false");
|
||||||
|
settings->setDefault("bilinear_filter", "false");
|
||||||
|
settings->setDefault("trilinear_filter", "false");
|
||||||
|
|
||||||
// Server stuff
|
// Server stuff
|
||||||
// "map-dir" doesn't exist by default.
|
// "map-dir" doesn't exist by default.
|
||||||
settings->setDefault("default_game", "minetest");
|
settings->setDefault("default_game", "minetest");
|
||||||
@ -142,10 +147,8 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
|
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
|
||||||
settings->setDefault("dedicated_server_step", "0.1");
|
settings->setDefault("dedicated_server_step", "0.1");
|
||||||
settings->setDefault("ignore_world_load_errors", "false");
|
settings->setDefault("ignore_world_load_errors", "false");
|
||||||
settings->setDefault("mip_map", "false");
|
settings->setDefault("congestion_control_aim_rtt", "0.2");
|
||||||
settings->setDefault("anisotropic_filter", "false");
|
settings->setDefault("congestion_control_max_rate", "400");
|
||||||
settings->setDefault("bilinear_filter", "false");
|
settings->setDefault("congestion_control_min_rate", "10");
|
||||||
settings->setDefault("trilinear_filter", "false");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user