added get_full_peer_list to retrieve all the peers known for a swarm
This commit is contained in:
@@ -189,6 +189,18 @@ namespace libtorrent
|
|||||||
int upload_rate_peak;
|
int upload_rate_peak;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TORRENT_EXPORT peer_list_entry
|
||||||
|
{
|
||||||
|
enum flags_t
|
||||||
|
{
|
||||||
|
banned = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
tcp::endpoint ip;
|
||||||
|
int flags;
|
||||||
|
boost::uint8_t failcount;
|
||||||
|
boost::uint8_t source;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TORRENT_PEER_INFO_HPP_INCLUDED
|
#endif // TORRENT_PEER_INFO_HPP_INCLUDED
|
||||||
|
@@ -298,6 +298,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
void resolve_peer_country(boost::intrusive_ptr<peer_connection> const& p) const;
|
void resolve_peer_country(boost::intrusive_ptr<peer_connection> const& p) const;
|
||||||
|
|
||||||
|
void get_full_peer_list(std::vector<peer_list_entry>& v) const;
|
||||||
void get_peer_info(std::vector<peer_info>& v);
|
void get_peer_info(std::vector<peer_info>& v);
|
||||||
void get_download_queue(std::vector<partial_piece_info>& queue);
|
void get_download_queue(std::vector<partial_piece_info>& queue);
|
||||||
|
|
||||||
|
@@ -284,6 +284,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
torrent_handle() {}
|
torrent_handle() {}
|
||||||
|
|
||||||
|
void get_full_peer_list(std::vector<peer_list_entry>& v) const;
|
||||||
void get_peer_info(std::vector<peer_info>& v) const;
|
void get_peer_info(std::vector<peer_info>& v) const;
|
||||||
torrent_status status() const;
|
torrent_status status() const;
|
||||||
void get_download_queue(std::vector<partial_piece_info>& queue) const;
|
void get_download_queue(std::vector<partial_piece_info>& queue) const;
|
||||||
|
@@ -2227,6 +2227,22 @@ namespace libtorrent
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void torrent::get_full_peer_list(std::vector<peer_list_entry>& v) const
|
||||||
|
{
|
||||||
|
v.clear();
|
||||||
|
v.reserve(m_policy.num_peers());
|
||||||
|
for (policy::const_iterator i = m_policy.begin_peer();
|
||||||
|
i != m_policy.end_peer(); ++i)
|
||||||
|
{
|
||||||
|
peer_list_entry e;
|
||||||
|
e.ip = i->second.ip;
|
||||||
|
e.flags = i->second.banned ? peer_list_entry::banned : 0;
|
||||||
|
e.failcount = i->second.failcount;
|
||||||
|
e.source = i->second.source;
|
||||||
|
v.push_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::get_peer_info(std::vector<peer_info>& v)
|
void torrent::get_peer_info(std::vector<peer_info>& v)
|
||||||
{
|
{
|
||||||
v.clear();
|
v.clear();
|
||||||
|
@@ -628,6 +628,12 @@ namespace libtorrent
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void torrent_handle::get_full_peer_list(std::vector<peer_list_entry>& v) const
|
||||||
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
TORRENT_FORWARD(get_full_peer_list(v));
|
||||||
|
}
|
||||||
|
|
||||||
void torrent_handle::get_peer_info(std::vector<peer_info>& v) const
|
void torrent_handle::get_peer_info(std::vector<peer_info>& v) const
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
Reference in New Issue
Block a user