fixed bug when torrent file have announce-list but no valid trackers. #444

This commit is contained in:
Arvid Norberg 2008-12-16 01:26:35 +00:00
parent f8ea5ffa07
commit e4ed68918b
2 changed files with 15 additions and 10 deletions

View File

@ -25,6 +25,8 @@ release 0.14.2
* removed support for boost-1.33 and earlier (probably didn't work)
* fixed potential freezes issues at shutdown
* improved error message for python setup script
* fixed bug when torrent file included announce-list, but no valid
tracker urls
release 0.14.1

View File

@ -575,20 +575,23 @@ namespace libtorrent
}
}
// shuffle each tier
std::vector<announce_entry>::iterator start = m_urls.begin();
std::vector<announce_entry>::iterator stop;
int current_tier = m_urls.front().tier;
for (stop = m_urls.begin(); stop != m_urls.end(); ++stop)
if (!m_urls.empty())
{
if (stop->tier != current_tier)
// shuffle each tier
std::vector<announce_entry>::iterator start = m_urls.begin();
std::vector<announce_entry>::iterator stop;
int current_tier = m_urls.front().tier;
for (stop = m_urls.begin(); stop != m_urls.end(); ++stop)
{
std::random_shuffle(start, stop);
start = stop;
current_tier = stop->tier;
if (stop->tier != current_tier)
{
std::random_shuffle(start, stop);
start = stop;
current_tier = stop->tier;
}
}
std::random_shuffle(start, stop);
}
std::random_shuffle(start, stop);
}