diff --git a/docs/manual.rst b/docs/manual.rst index 22f31b4fc..d4573abac 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -3038,6 +3038,8 @@ that will be sent to the tracker. The user-agent is a good way to identify your bool prioritize_partial_pieces; int auto_manage_startup; + + bool rate_limit_ip_overhead; }; ``user_agent`` this is the client identification to the tracker. @@ -3319,6 +3321,9 @@ active after it was started, regardless of upload and download speed. This is so that newly started torrents are not considered inactive until they have a fair chance to start downloading. +If ``rate_limit_ip_overhead`` is set to true, the estimated TCP/IP overhead is +drained from the rate limiters, to avoid exceeding the limits with the total traffic + pe_settings =========== diff --git a/include/libtorrent/session_settings.hpp b/include/libtorrent/session_settings.hpp index b7dc62a44..d8c974396 100644 --- a/include/libtorrent/session_settings.hpp +++ b/include/libtorrent/session_settings.hpp @@ -143,6 +143,7 @@ namespace libtorrent , min_announce_interval(5 * 60) , prioritize_partial_pieces(false) , auto_manage_startup(120) + , rate_limit_ip_overhead(true) {} // this is the user agent that will be sent to the tracker @@ -450,6 +451,11 @@ namespace libtorrent // inactive until they have a fair chance to // start downloading. int auto_manage_startup; + + // if set to true, the estimated TCP/IP overhead is + // drained from the rate limiters, to avoid exceeding + // the limits with the total traffic + bool rate_limit_ip_overhead; }; #ifndef TORRENT_DISABLE_DHT diff --git a/src/session_impl.cpp b/src/session_impl.cpp index e1a479e9e..092fd0102 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1121,10 +1121,13 @@ namespace aux { } // drain the IP overhead from the bandwidth limiters - m_download_channel.drain( - m_stat.download_ip_overhead() - + m_stat.download_dht() - + m_stat.download_tracker()); + if (m_settings.rate_limit_ip_overhead) + { + m_download_channel.drain( + m_stat.download_ip_overhead() + + m_stat.download_dht() + + m_stat.download_tracker()); + } if (m_stat.download_ip_overhead() >= m_download_channel.throttle() && m_alerts.should_post()) @@ -1133,10 +1136,13 @@ namespace aux { , performance_alert::download_limit_too_low)); } - m_upload_channel.drain( - m_stat.upload_ip_overhead() - + m_stat.upload_dht() - + m_stat.upload_tracker()); + if (m_settings.rate_limit_ip_overhead) + { + m_upload_channel.drain( + m_stat.upload_ip_overhead() + + m_stat.upload_dht() + + m_stat.upload_tracker()); + } if (m_stat.upload_ip_overhead() >= m_upload_channel.throttle() && m_alerts.should_post())