add trackers from add_torrent_params/magnet links to separate tiers
This commit is contained in:
parent
200b3c4965
commit
f33d1b32e3
|
@ -1,3 +1,4 @@
|
||||||
|
* add trackers from add_torrent_params/magnet links to separate tiers
|
||||||
* fix resumedata check issue with files with priority 0
|
* fix resumedata check issue with files with priority 0
|
||||||
* deprecated mmap_cache feature
|
* deprecated mmap_cache feature
|
||||||
* add utility function for generating peer ID fingerprint
|
* add utility function for generating peer ID fingerprint
|
||||||
|
|
|
@ -786,12 +786,14 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int tier = 0;
|
||||||
for (std::vector<std::string>::const_iterator i = p.trackers.begin()
|
for (std::vector<std::string>::const_iterator i = p.trackers.begin()
|
||||||
, end(p.trackers.end()); i != end; ++i)
|
, end(p.trackers.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
m_trackers.push_back(announce_entry(*i));
|
m_trackers.push_back(announce_entry(*i));
|
||||||
m_trackers.back().fail_limit = 0;
|
m_trackers.back().fail_limit = 0;
|
||||||
m_trackers.back().source = announce_entry::source_magnet_link;
|
m_trackers.back().source = announce_entry::source_magnet_link;
|
||||||
|
m_trackers.back().tier = tier++;
|
||||||
m_torrent_file->add_tracker(*i);
|
m_torrent_file->add_tracker(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,8 @@ TORRENT_TEST(magnet)
|
||||||
|
|
||||||
trackers = t2.trackers();
|
trackers = t2.trackers();
|
||||||
TEST_EQUAL(trackers.size(), 2);
|
TEST_EQUAL(trackers.size(), 2);
|
||||||
|
TEST_EQUAL(trackers[0].tier, 0);
|
||||||
|
TEST_EQUAL(trackers[1].tier, 1);
|
||||||
|
|
||||||
p.url = "magnet:"
|
p.url = "magnet:"
|
||||||
"?tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80"
|
"?tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80"
|
||||||
|
@ -162,16 +164,19 @@ TORRENT_TEST(magnet)
|
||||||
if (trackers.size() > 0)
|
if (trackers.size() > 0)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(trackers[0].url, "udp://tracker.openbittorrent.com:80");
|
TEST_EQUAL(trackers[0].url, "udp://tracker.openbittorrent.com:80");
|
||||||
|
TEST_EQUAL(trackers[0].tier, 0);
|
||||||
fprintf(stderr, "1: %s\n", trackers[0].url.c_str());
|
fprintf(stderr, "1: %s\n", trackers[0].url.c_str());
|
||||||
}
|
}
|
||||||
if (trackers.size() > 1)
|
if (trackers.size() > 1)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(trackers[1].url, "udp://tracker.publicbt.com:80");
|
TEST_EQUAL(trackers[1].url, "udp://tracker.publicbt.com:80");
|
||||||
|
TEST_EQUAL(trackers[1].tier, 1);
|
||||||
fprintf(stderr, "2: %s\n", trackers[1].url.c_str());
|
fprintf(stderr, "2: %s\n", trackers[1].url.c_str());
|
||||||
}
|
}
|
||||||
if (trackers.size() > 2)
|
if (trackers.size() > 2)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(trackers[2].url, "udp://tracker.ccc.de:80");
|
TEST_EQUAL(trackers[2].url, "udp://tracker.ccc.de:80");
|
||||||
|
TEST_EQUAL(trackers[2].tier, 2);
|
||||||
fprintf(stderr, "3: %s\n", trackers[2].url.c_str());
|
fprintf(stderr, "3: %s\n", trackers[2].url.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue