carve out peer_list_entry into also being deprecated (it was only used by deprecated functions and some tests)
This commit is contained in:
parent
b1c3e12cd0
commit
73942de97a
|
@ -421,6 +421,7 @@ namespace libtorrent {
|
|||
|
||||
};
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// internal
|
||||
struct TORRENT_EXTRA_EXPORT peer_list_entry
|
||||
{
|
||||
|
@ -439,6 +440,7 @@ namespace libtorrent {
|
|||
// internal
|
||||
std::uint8_t source;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -679,7 +679,9 @@ namespace libtorrent {
|
|||
peer_iterator begin() { return m_connections.begin(); }
|
||||
peer_iterator end() { return m_connections.end(); }
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void get_full_peer_list(std::vector<peer_list_entry>* v) const;
|
||||
#endif
|
||||
void get_peer_info(std::vector<peer_info>* v);
|
||||
void get_download_queue(std::vector<partial_piece_info>* queue) const;
|
||||
|
||||
|
|
|
@ -66,7 +66,9 @@ namespace libtorrent { namespace aux {
|
|||
class torrent_info;
|
||||
struct torrent_plugin;
|
||||
struct peer_info;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
struct peer_list_entry;
|
||||
#endif
|
||||
struct torrent_status;
|
||||
struct torrent_handle;
|
||||
struct storage_interface;
|
||||
|
|
|
@ -6237,6 +6237,7 @@ namespace libtorrent {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void torrent::get_full_peer_list(std::vector<peer_list_entry>* v) const
|
||||
{
|
||||
v->clear();
|
||||
|
@ -6253,6 +6254,7 @@ namespace libtorrent {
|
|||
v->push_back(e);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void torrent::get_peer_info(std::vector<peer_info>* v)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/announce_entry.hpp"
|
||||
#include "libtorrent/write_resume_data.hpp"
|
||||
|
||||
#if TORRENT_COMPLETE_TYPES_REQUIRED
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#include "libtorrent/peer_info.hpp" // for peer_list_entry
|
||||
#endif
|
||||
|
||||
|
|
|
@ -244,9 +244,13 @@ TORRENT_TEST(added_peers)
|
|||
|
||||
torrent_handle h = ses.add_torrent(std::move(p));
|
||||
|
||||
std::vector<peer_list_entry> v;
|
||||
h.native_handle()->get_full_peer_list(&v);
|
||||
TEST_EQUAL(v.size(), 2);
|
||||
h.save_resume_data();
|
||||
alert const* a = wait_for_alert(ses, save_resume_data_alert::alert_type);
|
||||
|
||||
TEST_CHECK(a);
|
||||
save_resume_data_alert const* ra = alert_cast<save_resume_data_alert>(a);
|
||||
TEST_CHECK(ra);
|
||||
if (ra) TEST_EQUAL(ra->params.peers.size(), 2);
|
||||
}
|
||||
|
||||
TORRENT_TEST(torrent)
|
||||
|
|
|
@ -467,21 +467,24 @@ TORRENT_TEST(http_peers)
|
|||
|
||||
// we expect to have certain peers in our peer list now
|
||||
// these peers are hard coded in web_server.py
|
||||
std::vector<peer_list_entry> peers;
|
||||
h.native_handle()->get_full_peer_list(&peers);
|
||||
h.save_resume_data();
|
||||
alert const* a = wait_for_alert(*s, save_resume_data_alert::alert_type);
|
||||
|
||||
std::set<tcp::endpoint> expected_peers;
|
||||
expected_peers.insert(ep("65.65.65.65", 16962));
|
||||
expected_peers.insert(ep("67.67.67.67", 17476));
|
||||
#if TORRENT_USE_IPV6
|
||||
expected_peers.insert(ep("4545:4545:4545:4545:4545:4545:4545:4545", 17990));
|
||||
#endif
|
||||
|
||||
TEST_EQUAL(peers.size(), expected_peers.size());
|
||||
for (std::vector<peer_list_entry>::iterator i = peers.begin()
|
||||
, end(peers.end()); i != end; ++i)
|
||||
TEST_CHECK(a);
|
||||
save_resume_data_alert const* ra = alert_cast<save_resume_data_alert>(a);
|
||||
TEST_CHECK(ra);
|
||||
if (ra)
|
||||
{
|
||||
TEST_EQUAL(expected_peers.count(i->ip), 1);
|
||||
std::set<tcp::endpoint> expected_peers;
|
||||
expected_peers.insert(ep("65.65.65.65", 16962));
|
||||
expected_peers.insert(ep("67.67.67.67", 17476));
|
||||
#if TORRENT_USE_IPV6
|
||||
expected_peers.insert(ep("4545:4545:4545:4545:4545:4545:4545:4545", 17990));
|
||||
#endif
|
||||
for (auto const& ip : ra->params.peers)
|
||||
{
|
||||
TEST_EQUAL(expected_peers.count(ip), 1);
|
||||
}
|
||||
}
|
||||
|
||||
std::printf("destructing session\n");
|
||||
|
|
Loading…
Reference in New Issue