remove functionality to initiate MTU based on the MTU on the nic (this is error prone and has questionable value)
This commit is contained in:
parent
3018546b37
commit
d43af6e3b7
|
@ -477,16 +477,6 @@ namespace libtorrent
|
||||||
// libtorrent API.
|
// libtorrent API.
|
||||||
report_web_seed_downloads,
|
report_web_seed_downloads,
|
||||||
|
|
||||||
// controls if the uTP socket manager is allowed to increase the
|
|
||||||
// socket buffer if a network interface with a large MTU is used (such
|
|
||||||
// as loopback or ethernet jumbo frames). This defaults to true and
|
|
||||||
// might improve uTP throughput. For RAM constrained systems,
|
|
||||||
// disabling this typically saves around 30kB in user space 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_dynamic_sock_buf,
|
|
||||||
|
|
||||||
// set to true if uTP connections should be rate limited This option
|
// set to true if uTP connections should be rate limited This option
|
||||||
// is *DEPRECATED*, please use set_peer_class_filter() instead.
|
// is *DEPRECATED*, please use set_peer_class_filter() instead.
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
|
|
@ -87,7 +87,6 @@ namespace libtorrent
|
||||||
int connect_timeout() const { return m_sett.get_int(settings_pack::utp_connect_timeout); }
|
int connect_timeout() const { return m_sett.get_int(settings_pack::utp_connect_timeout); }
|
||||||
int min_timeout() const { return m_sett.get_int(settings_pack::utp_min_timeout); }
|
int min_timeout() const { return m_sett.get_int(settings_pack::utp_min_timeout); }
|
||||||
int loss_multiplier() const { return m_sett.get_int(settings_pack::utp_loss_multiplier); }
|
int loss_multiplier() const { return m_sett.get_int(settings_pack::utp_loss_multiplier); }
|
||||||
bool allow_dynamic_sock_buf() const { return m_sett.get_bool(settings_pack::utp_dynamic_sock_buf); }
|
|
||||||
|
|
||||||
void mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu);
|
void mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu);
|
||||||
void set_sock_buf(int size);
|
void set_sock_buf(int size);
|
||||||
|
|
|
@ -167,9 +167,6 @@ namespace libtorrent
|
||||||
// whole pieces
|
// whole pieces
|
||||||
set.set_bool(settings_pack::coalesce_reads, false);
|
set.set_bool(settings_pack::coalesce_reads, false);
|
||||||
set.set_bool(settings_pack::coalesce_writes, false);
|
set.set_bool(settings_pack::coalesce_writes, false);
|
||||||
|
|
||||||
// disallow the buffer size to grow for the uTP socket
|
|
||||||
set.set_bool(settings_pack::utp_dynamic_sock_buf, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_EXPORT void high_performance_seed(settings_pack& set)
|
TORRENT_EXPORT void high_performance_seed(settings_pack& set)
|
||||||
|
@ -281,9 +278,6 @@ namespace libtorrent
|
||||||
// connect to us if they want to
|
// connect to us if they want to
|
||||||
set.set_int(settings_pack::max_failcount, 1);
|
set.set_int(settings_pack::max_failcount, 1);
|
||||||
|
|
||||||
// allow the buffer size to grow for the uTP socket
|
|
||||||
set.set_bool(settings_pack::utp_dynamic_sock_buf, true);
|
|
||||||
|
|
||||||
// we're likely to have more than 4 cores on a high
|
// we're likely to have more than 4 cores on a high
|
||||||
// performance machine. One core is needed for the
|
// performance machine. One core is needed for the
|
||||||
// network thread
|
// network thread
|
||||||
|
|
|
@ -185,7 +185,6 @@ namespace libtorrent
|
||||||
SET(no_recheck_incomplete_resume, false, 0),
|
SET(no_recheck_incomplete_resume, false, 0),
|
||||||
SET(anonymous_mode, false, &session_impl::update_anonymous_mode),
|
SET(anonymous_mode, false, &session_impl::update_anonymous_mode),
|
||||||
SET(report_web_seed_downloads, true, &session_impl::update_report_web_seed_downloads),
|
SET(report_web_seed_downloads, true, &session_impl::update_report_web_seed_downloads),
|
||||||
SET(utp_dynamic_sock_buf, true, 0),
|
|
||||||
DEPRECATED_SET(rate_limit_utp, false, &session_impl::update_rate_limit_utp),
|
DEPRECATED_SET(rate_limit_utp, false, &session_impl::update_rate_limit_utp),
|
||||||
SET(announce_double_nat, false, 0),
|
SET(announce_double_nat, false, 0),
|
||||||
SET(seeding_outgoing_connections, true, 0),
|
SET(seeding_outgoing_connections, true, 0),
|
||||||
|
|
|
@ -90,34 +90,10 @@ namespace libtorrent
|
||||||
|
|
||||||
void utp_socket_manager::mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu)
|
void utp_socket_manager::mtu_for_dest(address const& addr, int& link_mtu, int& utp_mtu)
|
||||||
{
|
{
|
||||||
if (aux::time_now() - seconds(60) > m_last_route_update)
|
|
||||||
{
|
|
||||||
m_last_route_update = aux::time_now();
|
|
||||||
error_code ec;
|
|
||||||
m_routes = enum_routes(m_sock.get_io_service(), ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mtu = 0;
|
int mtu = 0;
|
||||||
if (!m_routes.empty())
|
|
||||||
{
|
|
||||||
for (std::vector<ip_route>::iterator i = m_routes.begin()
|
|
||||||
, end(m_routes.end()); i != end; ++i)
|
|
||||||
{
|
|
||||||
if (!match_addr_mask(addr, i->destination, i->netmask)) continue;
|
|
||||||
|
|
||||||
// assume that we'll actually use the route with the largest
|
|
||||||
// MTU (seems like a reasonable assumption).
|
|
||||||
// this could however be improved by using the route metrics
|
|
||||||
// and the prefix length of the netmask to order the matches
|
|
||||||
if (mtu < i->mtu) mtu = i->mtu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mtu == 0)
|
|
||||||
{
|
|
||||||
if (is_teredo(addr)) mtu = TORRENT_TEREDO_MTU;
|
if (is_teredo(addr)) mtu = TORRENT_TEREDO_MTU;
|
||||||
else mtu = TORRENT_ETHERNET_MTU;
|
else mtu = TORRENT_ETHERNET_MTU;
|
||||||
}
|
|
||||||
|
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
// apple has a very strange loopback. It appears you can't
|
// apple has a very strange loopback. It appears you can't
|
||||||
|
|
|
@ -2646,17 +2646,7 @@ void utp_socket_impl::init_mtu(int link_mtu, int utp_mtu)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
// if we're in a RAM constrained environment, don't increase
|
if (link_mtu > TORRENT_ETHERNET_MTU)
|
||||||
// the buffer size for interfaces with large MTUs. Just stick
|
|
||||||
// to ethernet frame sizes
|
|
||||||
if (m_sm->allow_dynamic_sock_buf())
|
|
||||||
{
|
|
||||||
// Make sure that we have enough socket buffer space
|
|
||||||
// for sending and receiving packets of this size
|
|
||||||
// add 10% for smaller ACKs and other overhead
|
|
||||||
m_sm->set_sock_buf(link_mtu * 11 / 10);
|
|
||||||
}
|
|
||||||
else if (link_mtu > TORRENT_ETHERNET_MTU)
|
|
||||||
{
|
{
|
||||||
// we can't use larger packets than this since we're
|
// we can't use larger packets than this since we're
|
||||||
// not allocating any more memory for socket buffers
|
// not allocating any more memory for socket buffers
|
||||||
|
|
|
@ -81,7 +81,6 @@ void test_transfer()
|
||||||
pack.set_bool(settings_pack::announce_to_all_trackers, true);
|
pack.set_bool(settings_pack::announce_to_all_trackers, true);
|
||||||
pack.set_bool(settings_pack::announce_to_all_tiers, true);
|
pack.set_bool(settings_pack::announce_to_all_tiers, true);
|
||||||
pack.set_bool(settings_pack::prefer_udp_trackers, false);
|
pack.set_bool(settings_pack::prefer_udp_trackers, false);
|
||||||
pack.set_bool(settings_pack::utp_dynamic_sock_buf, true);
|
|
||||||
pack.set_int(settings_pack::min_reconnect_time, 1);
|
pack.set_int(settings_pack::min_reconnect_time, 1);
|
||||||
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48885");
|
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48885");
|
||||||
lt::session ses1(pack);
|
lt::session ses1(pack);
|
||||||
|
|
Loading…
Reference in New Issue