remove special handling of uTP peers

This commit is contained in:
arvidn 2018-07-13 17:48:33 +02:00 committed by Arvid Norberg
parent 5bb5ba145f
commit 1ebc5f9ef2
7 changed files with 23 additions and 32 deletions

View File

@ -1,3 +1,4 @@
* uTP connections are no longer exempt from rate limits by default
* fix exporting files from partfile while seeding
* fix potential deadlock on Windows, caused by performing restricted
tasks from within DllMain

View File

@ -891,13 +891,11 @@ based peer class assignment:
ip_filter f;
// for every IPv4 address, assign the global peer class
f.add_rule(address_v4::from_string("0.0.0.0")
, address_v4::from_string("255.255.255.255")
, mask);
f.add_rule(make_address("0.0.0.0"), make_address("255.255.255.255"), mask);
// for every IPv6 address, assign the global peer class
f.add_rule(address_v6::from_string("::")
, address_v6::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
f.add_rule(make_address("::")
, make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
, mask);
ses.set_peer_class_filter(f);
@ -905,7 +903,7 @@ To make uTP sockets exempt from rate limiting:
.. code:: c++
peer_class_type_filter flt;
peer_class_type_filter flt = ses.get_peer_class_type_filter();
// filter out the global and local peer class for uTP sockets, if these
// classes are set by the IP filter
flt.disallow(peer_class_type_filter::utp_socket, session::global_peer_class_id);
@ -925,14 +923,10 @@ To make all peers on the internal network unthrottled:
ip_filter f;
// for every IPv4 address, assign the global peer class
f.add_rule(address_v4::from_string("0.0.0.0")
, address_v4::from_string("255.255.255.255")
, mask);
f.add_rule(make_address("0.0.0.0"), make_address("255.255.255.255"), mask);
// for every address on the local metwork, set the mastk to 0
f.add_rule(address_v4::from_string("10.0.0.0")
, address_v4::from_string("10.255.255.255")
, 0);
// for every address on the local metwork, set the mask to 0
f.add_rule(make_address("10.0.0.0"), make_address("10.255.255.255"), 0);
ses.set_peer_class_filter(f);
SSL torrents

View File

@ -408,8 +408,8 @@ namespace libtorrent
// -1 means unlimited on these settings just like their counterpart
// functions on torrent_handle
//
// For fine grained control over rate limits, including making them apply
// to local peers, see peer-classes_.
// For fine grained control over rate limits depending on various
// properties of the peer connection, see peer-classes_.
int max_uploads;
int max_connections;
int upload_limit;

View File

@ -632,10 +632,9 @@ namespace libtorrent
//
// .. code:: c++
//
// ip_filter f;
// peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range");
// f.add_rule(address_v4::from_string("200.1.1.0")
// , address_v4::from_string("200.1.255.255")
// ip_filter f = ses.get_peer_class_filter();
// peer_class_t const my_class = ses.create_peer_class("200.1.x.x IP range");
// f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255")
// , 1 << my_class);
// ses.set_peer_class_filter(f);
//
@ -682,7 +681,7 @@ namespace libtorrent
// make sure to create those early on, to get low identifiers.
//
// For more information on peer classes, see peer-classes_.
int create_peer_class(char const* name);
peer_class_t create_peer_class(char const* name);
// This call dereferences the reference count of the specified peer
// class. When creating a peer class it's automatically referenced by 1.
@ -701,7 +700,7 @@ namespace libtorrent
// destructs.
//
// For more information on peer classes, see peer-classes_.
void delete_peer_class(int cid);
void delete_peer_class(peer_class_t cid);
// These functions queries information from a peer class and updates the
// configuration of a peer class, respectively.
@ -718,8 +717,8 @@ namespace libtorrent
// account.
//
// For more information, see peer-classes_.
peer_class_info get_peer_class(int cid);
void set_peer_class(int cid, peer_class_info const& pci);
peer_class_info get_peer_class(peer_class_t cid);
void set_peer_class(peer_class_t cid, peer_class_info const& pci);
#ifndef TORRENT_NO_DEPRECATE
// if the listen port failed in some way you can retry to listen on

View File

@ -522,9 +522,9 @@ namespace libtorrent
// libtorrent API.
report_web_seed_downloads,
#ifndef TORRENT_NO_DEPRECATE
// set to true if uTP connections should be rate limited This option
// is *DEPRECATED*, please use set_peer_class_filter() instead.
#ifndef TORRENT_NO_DEPRECATE
rate_limit_utp TORRENT_DEPRECATED_ENUM,
#else
deprecated2,

View File

@ -511,9 +511,6 @@ namespace aux {
m_peer_class_type_filter.add(peer_class_type_filter::ssl_tcp_socket, m_tcp_peer_class);
m_peer_class_type_filter.add(peer_class_type_filter::i2p_socket, m_tcp_peer_class);
// TODO: there's no rule here to make uTP connections not have the global or
// local rate limits apply to it. This used to be the default.
#ifndef TORRENT_DISABLE_LOGGING
session_log("config: %s version: %s revision: %s"
@ -1279,7 +1276,7 @@ namespace aux {
return m_classes.new_peer_class(name);
}
void session_impl::delete_peer_class(int cid)
void session_impl::delete_peer_class(peer_class_t const cid)
{
TORRENT_ASSERT(is_single_thread());
// if you hit this assert, you're deleting a non-existent peer class
@ -1288,7 +1285,7 @@ namespace aux {
m_classes.decref(cid);
}
peer_class_info session_impl::get_peer_class(int cid)
peer_class_info session_impl::get_peer_class(peer_class_t const cid)
{
peer_class_info ret;
peer_class* pc = m_classes.at(cid);
@ -1340,7 +1337,7 @@ namespace aux {
m_tracker_manager.queue_request(get_io_service(), req, c);
}
void session_impl::set_peer_class(int cid, peer_class_info const& pci)
void session_impl::set_peer_class(peer_class_t const cid, peer_class_info const& pci)
{
peer_class* pc = m_classes.at(cid);
// if you hit this assert, you're passing in an invalid cid
@ -6238,7 +6235,7 @@ retry:
{
return download_rate_limit(m_global_class);
}
#endif
#endif // DEPRECATE
// TODO: 2 this should be factored into the udp socket, so we only have the
// code once

View File

@ -204,7 +204,7 @@ namespace libtorrent
SET(no_recheck_incomplete_resume, false, 0),
SET(anonymous_mode, false, &session_impl::update_anonymous_mode),
SET(report_web_seed_downloads, true, &session_impl::update_report_web_seed_downloads),
DEPRECATED_SET(rate_limit_utp, false, &session_impl::update_rate_limit_utp),
DEPRECATED_SET(rate_limit_utp, true, &session_impl::update_rate_limit_utp),
SET(announce_double_nat, false, 0),
SET(seeding_outgoing_connections, true, 0),
SET(no_connect_privileged_ports, false, &session_impl::update_privileged_ports),