url downloading fix

This commit is contained in:
Arvid Norberg 2010-12-30 06:46:28 +00:00
parent 6e46c678d3
commit a3e7095f84
2 changed files with 10 additions and 0 deletions

View File

@ -699,6 +699,8 @@ namespace libtorrent
torrent_info const& torrent_file() const
{ return *m_torrent_file; }
std::string const& url() const { return m_url; }
std::vector<announce_entry> const& trackers() const
{ return m_trackers; }

View File

@ -3575,6 +3575,14 @@ namespace aux {
session_impl::torrent_map::iterator i =
m_torrents.find(tptr->torrent_file().info_hash());
// this torrent might be filed under the URL-hash
if (i == m_torrents.end() && !tptr->url().empty())
{
std::string const& url = tptr->url();
sha1_hash urlhash = hasher(&url[0], url.size()).final();
i = m_torrents.find(urlhash);
}
if (i != m_torrents.end())
{
torrent& t = *i->second;