set uTP target delay to 100 ms. expose setting for packet loss multiplier for cwnd

This commit is contained in:
Arvid Norberg 2012-03-11 05:46:15 +00:00
parent d8b221c795
commit df2e891a2d
4 changed files with 15 additions and 2 deletions

View File

@ -4526,6 +4526,7 @@ session_settings
int utp_connect_timeout;
int utp_delayed_ack;
bool utp_dynamic_sock_buf;
int utp_loss_multiplier;
enum bandwidth_mixed_algo_t
{
@ -5349,6 +5350,11 @@ For RAM constrained systems, disabling this typically saves around 30kB in user
and probably around 400kB in kernel socket buffers (it adjusts the send and receive
buffer size on the kernel socket, both for IPv4 and IPv6).
``utp_loss_multiplier`` controls how the congestion window is changed when a packet
loss is experienced. It's specified as a percentage multiplier for ``cwnd``. By default
it's set to 50 (i.e. cut in half). Do not change this value unless you know what
you're doing. Never set it higher than 100.
The ``mixed_mode_algorithm`` determines how to treat TCP connections when there are
uTP connections. Since uTP is designed to yield to TCP, there's an inherent problem
when using swarms that have both TCP and uTP connections. If nothing is done, uTP

View File

@ -245,7 +245,7 @@ namespace libtorrent
, unchoke_slots_limit(8)
, half_open_limit(0)
, connections_limit(200)
, utp_target_delay(75) // milliseconds
, utp_target_delay(100) // milliseconds
, utp_gain_factor(1500) // bytes per rtt
, utp_min_timeout(500) // milliseconds
, utp_syn_resends(2)
@ -254,6 +254,7 @@ namespace libtorrent
, utp_connect_timeout(3000) // milliseconds
, utp_delayed_ack(0) // milliseconds
, utp_dynamic_sock_buf(true)
, utp_loss_multiplier(50) // specified in percent
, mixed_mode_algorithm(peer_proportional)
, rate_limit_utp(false)
, listen_queue_size(5)
@ -1008,6 +1009,11 @@ namespace libtorrent
// including loopback
bool utp_dynamic_sock_buf;
// what to multiply the congestion window by on packet loss.
// it's specified as a percent. The default is 50, i.e. cut
// in half
int utp_loss_multiplier;
enum bandwidth_mixed_algo_t
{
// disables the mixed mode bandwidth balancing

View File

@ -78,6 +78,7 @@ namespace libtorrent
int connect_timeout() const { return m_sett.utp_connect_timeout; }
int delayed_ack() const { return m_sett.utp_delayed_ack; }
int min_timeout() const { return m_sett.utp_min_timeout; }
int loss_multiplier() const { return m_sett.utp_loss_multiplier; }
bool allow_dynamic_sock_buf() const { return m_sett.utp_dynamic_sock_buf; }
void mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu);

View File

@ -1804,7 +1804,7 @@ void utp_socket_impl::experienced_loss(int seq_nr)
if (compare_less_wrap(seq_nr, m_loss_seq_nr, ACK_MASK)) return;
// cut window size in 2
m_cwnd = (std::max)(m_cwnd / 2, boost::int64_t(m_mtu << 16));
m_cwnd = (std::max)(m_cwnd * m_sm->loss_multiplier() / 100, boost::int64_t(m_mtu << 16));
m_loss_seq_nr = m_seq_nr;
UTP_LOGV("%8p: Lost packet %d caused cwnd cut\n", this, seq_nr);