fix rate limit utp feature

This commit is contained in:
arvidn 2017-12-08 09:49:33 +01:00 committed by Arvid Norberg
parent 34fc3d0f18
commit fe6473039c
7 changed files with 22 additions and 12 deletions

View File

@ -6649,25 +6649,17 @@ retry:
if (m_settings.get_bool(settings_pack::rate_limit_utp))
{
// allow the global or local peer class to limit uTP peers
m_peer_class_type_filter.add(peer_class_type_filter::utp_socket
, m_local_peer_class);
m_peer_class_type_filter.add(peer_class_type_filter::utp_socket
m_peer_class_type_filter.allow(peer_class_type_filter::utp_socket
, m_global_class);
m_peer_class_type_filter.add(peer_class_type_filter::ssl_utp_socket
, m_local_peer_class);
m_peer_class_type_filter.add(peer_class_type_filter::ssl_utp_socket
m_peer_class_type_filter.allow(peer_class_type_filter::ssl_utp_socket
, m_global_class);
}
else
{
// don't add the global or local peer class to limit uTP peers
m_peer_class_type_filter.remove(peer_class_type_filter::utp_socket
, m_local_peer_class);
m_peer_class_type_filter.remove(peer_class_type_filter::utp_socket
m_peer_class_type_filter.disallow(peer_class_type_filter::utp_socket
, m_global_class);
m_peer_class_type_filter.remove(peer_class_type_filter::ssl_utp_socket
, m_local_peer_class);
m_peer_class_type_filter.remove(peer_class_type_filter::ssl_utp_socket
m_peer_class_type_filter.disallow(peer_class_type_filter::ssl_utp_socket
, m_global_class);
}
}

View File

@ -74,6 +74,9 @@ void test_swarm()
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_dht, false);
#ifndef TORRENT_NO_DEPRECATE
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_forced);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_forced);

View File

@ -424,6 +424,9 @@ boost::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
sett.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
sett.set_bool(settings_pack::enable_outgoing_utp, false);
sett.set_bool(settings_pack::enable_incoming_utp, false);
#ifndef TORRENT_NO_DEPRECATE
sett.set_bool(settings_pack::rate_limit_utp, true);
#endif
ses.reset(new lt::session(sett, lt::session::add_default_plugins));
error_code ec;

View File

@ -59,6 +59,9 @@ void test_lsd()
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_str(settings_pack::listen_interfaces, "127.0.0.1:48100");
#ifndef TORRENT_NO_DEPRECATE
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
lt::session ses1(pack);

View File

@ -76,6 +76,9 @@ void test_pex()
pack.set_bool(settings_pack::enable_dht, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_natpmp, false);
#ifndef TORRENT_NO_DEPRECATE
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_forced);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_forced);

View File

@ -106,6 +106,9 @@ void test_transfer(settings_pack const& sett)
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
pack.set_int(settings_pack::alert_mask, mask);
#ifndef TORRENT_NO_DEPRECATE
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
lt::session ses1(pack);

View File

@ -153,6 +153,9 @@ void test_transfer(int proxy_type, settings_pack const& sett
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_dht, false);
#ifndef TORRENT_NO_DEPRECATE
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
lt::session ses1(pack);