Merge pull request #101 from arvidn/remove-utp-nic-mtu

remove functionality to initiate MTU based on the MTU on the nic
This commit is contained in:
Arvid Norberg 2015-08-22 10:40:17 +02:00
commit 715ed1b11d
8 changed files with 5 additions and 59 deletions

View File

@ -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

View File

@ -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);
@ -123,7 +122,7 @@ namespace libtorrent
// user callback function to indicate bytes have been // user callback function to indicate bytes have been
// sent or received. // sent or received.
std::vector<utp_socket_impl*> m_drained_event; std::vector<utp_socket_impl*> m_drained_event;
// list of sockets that received EWOULDBLOCK from the // list of sockets that received EWOULDBLOCK from the
// underlying socket. They are notified when the socket // underlying socket. They are notified when the socket
// becomes writable again // becomes writable again

View File

@ -99,7 +99,6 @@ struct test_swarm_config : swarm_config
if (m_flags & utp) if (m_flags & utp)
{ {
s.set_bool(settings_pack::utp_dynamic_sock_buf, true);
s.set_bool(settings_pack::enable_incoming_utp, true); s.set_bool(settings_pack::enable_incoming_utp, true);
s.set_bool(settings_pack::enable_outgoing_utp, true); s.set_bool(settings_pack::enable_outgoing_utp, true);
s.set_bool(settings_pack::enable_incoming_tcp, false); s.set_bool(settings_pack::enable_incoming_tcp, false);

View File

@ -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)
@ -275,15 +272,12 @@ namespace libtorrent
// always stuff at least 1 MiB down each peer // always stuff at least 1 MiB down each peer
// pipe, to quickly ramp up send rates // pipe, to quickly ramp up send rates
set.set_int(settings_pack::send_buffer_low_watermark, 1 * 1024 * 1024); set.set_int(settings_pack::send_buffer_low_watermark, 1 * 1024 * 1024);
// don't retry peers if they fail once. Let them // don't retry peers if they fail once. Let them
// 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

View File

@ -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),

View File

@ -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()) if (is_teredo(addr)) mtu = TORRENT_TEREDO_MTU;
{ else mtu = TORRENT_ETHERNET_MTU;
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;
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

View File

@ -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

View File

@ -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);