merged name resolver fix from RC_0_16

This commit is contained in:
Arvid Norberg 2013-02-02 23:59:11 +00:00
parent 09946aee26
commit 327626b830
3 changed files with 11 additions and 6 deletions

View File

@ -12,6 +12,7 @@
* fix uTP edge case where udp socket buffer fills up * fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP * 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 * make torrent file parser reject invalid path elements earlier
* fixed piece picker bug when using pad-files * fixed piece picker bug when using pad-files
* fix read-piece response for cancelled deadline-pieces * fix read-piece response for cancelled deadline-pieces

View File

@ -1005,6 +1005,9 @@ namespace libtorrent
// this torrent belongs to. // this torrent belongs to.
aux::session_impl& m_ses; aux::session_impl& m_ses;
// used to resolve hostnames for web seeds
mutable tcp::resolver m_host_resolver;
std::vector<boost::uint8_t> m_file_priority; std::vector<boost::uint8_t> m_file_priority;
// this vector contains the number of bytes completely // this vector contains the number of bytes completely

View File

@ -350,6 +350,7 @@ namespace libtorrent
, m_num_connecting(0) , m_num_connecting(0)
, m_tracker_timer(ses.m_io_service) , m_tracker_timer(ses.m_io_service)
, m_ses(ses) , m_ses(ses)
, m_host_resolver(ses.m_io_service)
, m_trackerid(p.trackerid) , m_trackerid(p.trackerid)
, m_save_path(complete(p.save_path)) , m_save_path(complete(p.save_path))
, m_url(p.url) , m_url(p.url)
@ -2599,7 +2600,7 @@ namespace libtorrent
add_outstanding_async("torrent::on_peer_name_lookup"); add_outstanding_async("torrent::on_peer_name_lookup");
#endif #endif
tcp::resolver::query q(i->ip, to_string(i->port).elems); 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)); 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); set_state(torrent_status::queued_for_checking);
m_owning_storage = 0; m_owning_storage = 0;
m_ses.m_host_resolver.cancel(); m_host_resolver.cancel();
} }
void torrent::super_seeding(bool on) void torrent::super_seeding(bool on)
@ -4578,7 +4579,7 @@ namespace libtorrent
// use proxy // use proxy
web->resolving = true; web->resolving = true;
tcp::resolver::query q(ps.hostname, to_string(ps.port).elems); 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)); boost::bind(&torrent::on_proxy_name_lookup, shared_from_this(), _1, _2, web));
} }
else if (ps.proxy_hostnames else if (ps.proxy_hostnames
@ -4591,7 +4592,7 @@ namespace libtorrent
{ {
web->resolving = true; web->resolving = true;
tcp::resolver::query q(hostname, to_string(port).elems); 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 boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, web
, tcp::endpoint())); , tcp::endpoint()));
} }
@ -4683,7 +4684,7 @@ namespace libtorrent
web->resolving = true; web->resolving = true;
tcp::resolver::query q(hostname, to_string(port).elems); 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)); boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, web, a));
} }
@ -4909,7 +4910,7 @@ namespace libtorrent
return; return;
} }
m_resolving_country = true; 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)); boost::bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p));
} }