diff --git a/ChangeLog b/ChangeLog index cfec0290b..3257370a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix torrent-abort issue which would cancel name lookups of other torrents * make torrent file parser reject invalid path elements earlier * fixed piece picker bug when using pad-files * fix read-piece response for cancelled deadline-pieces diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index b5789433a..af6f7bd42 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -1005,6 +1005,9 @@ namespace libtorrent // this torrent belongs to. aux::session_impl& m_ses; + // used to resolve hostnames for web seeds + mutable tcp::resolver m_host_resolver; + std::vector m_file_priority; // this vector contains the number of bytes completely diff --git a/src/torrent.cpp b/src/torrent.cpp index 46aae4e59..a1e5318a7 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -350,6 +350,7 @@ namespace libtorrent , m_num_connecting(0) , m_tracker_timer(ses.m_io_service) , m_ses(ses) + , m_host_resolver(ses.m_io_service) , m_trackerid(p.trackerid) , m_save_path(complete(p.save_path)) , m_url(p.url) @@ -2599,7 +2600,7 @@ namespace libtorrent add_outstanding_async("torrent::on_peer_name_lookup"); #endif tcp::resolver::query q(i->ip, to_string(i->port).elems); - m_ses.m_host_resolver.async_resolve(q, + m_host_resolver.async_resolve(q, boost::bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i->pid)); } } @@ -3548,7 +3549,7 @@ namespace libtorrent set_state(torrent_status::queued_for_checking); m_owning_storage = 0; - m_ses.m_host_resolver.cancel(); + m_host_resolver.cancel(); } void torrent::super_seeding(bool on) @@ -4578,7 +4579,7 @@ namespace libtorrent // use proxy web->resolving = true; tcp::resolver::query q(ps.hostname, to_string(ps.port).elems); - m_ses.m_host_resolver.async_resolve(q, + m_host_resolver.async_resolve(q, boost::bind(&torrent::on_proxy_name_lookup, shared_from_this(), _1, _2, web)); } else if (ps.proxy_hostnames @@ -4591,7 +4592,7 @@ namespace libtorrent { web->resolving = true; tcp::resolver::query q(hostname, to_string(port).elems); - m_ses.m_host_resolver.async_resolve(q, + m_host_resolver.async_resolve(q, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, web , tcp::endpoint())); } @@ -4683,7 +4684,7 @@ namespace libtorrent web->resolving = true; tcp::resolver::query q(hostname, to_string(port).elems); - m_ses.m_host_resolver.async_resolve(q, + m_host_resolver.async_resolve(q, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, web, a)); } @@ -4909,7 +4910,7 @@ namespace libtorrent return; } m_resolving_country = true; - m_ses.m_host_resolver.async_resolve(q, + m_host_resolver.async_resolve(q, boost::bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p)); }