deprecate functions in torrent_handle (#828)

deprecate get_full_peer_list on torrent_handle
This commit is contained in:
Alden Torres 2016-06-17 16:07:28 -04:00 committed by Arvid Norberg
parent 4d927f4029
commit 2cc1054d7d
5 changed files with 10 additions and 9 deletions

View File

@ -162,7 +162,7 @@ namespace libtorrent
// connect via the NAT holepunch mechanism. // connect via the NAT holepunch mechanism.
holepunched = 0x8000, holepunched = 0x8000,
// indicates that this socket is runnin on top of the // indicates that this socket is running on top of the
// I2P transport. // I2P transport.
i2p_socket = 0x10000, i2p_socket = 0x10000,
@ -416,7 +416,7 @@ namespace libtorrent
}; };
// internal // internal
struct TORRENT_EXPORT peer_list_entry struct TORRENT_EXTRA_EXPORT peer_list_entry
{ {
// internal // internal
enum flags_t enum flags_t

View File

@ -43,7 +43,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/weak_ptr.hpp> #include <boost/weak_ptr.hpp>
#include <boost/cstdint.hpp>
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// for deprecated force_reannounce // for deprecated force_reannounce
@ -242,12 +241,8 @@ namespace libtorrent
// add_torrent_params. Perhaps those flags should have a more generic // add_torrent_params. Perhaps those flags should have a more generic
// name. // name.
// TODO: 4 remove some of these friends
friend class invariant_access;
friend struct aux::session_impl; friend struct aux::session_impl;
friend class session;
friend struct session_handle; friend struct session_handle;
friend struct feed;
friend class torrent; friend class torrent;
friend std::size_t hash_value(torrent_handle const& th); friend std::size_t hash_value(torrent_handle const& th);
@ -298,8 +293,11 @@ namespace libtorrent
// otherwise. // otherwise.
bool have_piece(int piece) const; bool have_piece(int piece) const;
#ifndef TORRENT_NO_DEPRECATE
// internal // internal
TORRENT_DEPRECATED
void get_full_peer_list(std::vector<peer_list_entry>& v) const; void get_full_peer_list(std::vector<peer_list_entry>& v) const;
#endif
// takes a reference to a vector that will be cleared and filled with one // takes a reference to a vector that will be cleared and filled with one
// entry for each peer connected to this torrent, given the handle is // entry for each peer connected to this torrent, given the handle is

View File

@ -682,11 +682,13 @@ namespace libtorrent
async_call(&torrent::set_super_seeding, on); async_call(&torrent::set_super_seeding, on);
} }
#ifndef TORRENT_NO_DEPRECATE
void torrent_handle::get_full_peer_list(std::vector<peer_list_entry>& v) const void torrent_handle::get_full_peer_list(std::vector<peer_list_entry>& v) const
{ {
auto vp = &v; auto vp = &v;
sync_call(&torrent::get_full_peer_list, vp); sync_call(&torrent::get_full_peer_list, vp);
} }
#endif
void torrent_handle::get_peer_info(std::vector<peer_info>& v) const void torrent_handle::get_peer_info(std::vector<peer_info>& v) const
{ {

View File

@ -238,7 +238,7 @@ TORRENT_TEST(added_peers)
torrent_handle h = ses.add_torrent(p); torrent_handle h = ses.add_torrent(p);
std::vector<peer_list_entry> v; std::vector<peer_list_entry> v;
h.get_full_peer_list(v); h.native_handle()->get_full_peer_list(&v);
TEST_EQUAL(v.size(), 2); TEST_EQUAL(v.size(), 2);
} }

View File

@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response #include "libtorrent/http_tracker_connection.hpp" // for parse_tracker_response
#include "libtorrent/torrent_info.hpp" #include "libtorrent/torrent_info.hpp"
#include "libtorrent/announce_entry.hpp" #include "libtorrent/announce_entry.hpp"
#include "libtorrent/torrent.hpp"
#include <fstream> #include <fstream>
@ -427,7 +428,7 @@ TORRENT_TEST(http_peers)
// we expect to have certain peers in our peer list now // we expect to have certain peers in our peer list now
// these peers are hard coded in web_server.py // these peers are hard coded in web_server.py
std::vector<peer_list_entry> peers; std::vector<peer_list_entry> peers;
h.get_full_peer_list(peers); h.native_handle()->get_full_peer_list(&peers);
std::set<tcp::endpoint> expected_peers; std::set<tcp::endpoint> expected_peers;
expected_peers.insert(tcp::endpoint(address_v4::from_string("65.65.65.65"), 16962)); expected_peers.insert(tcp::endpoint(address_v4::from_string("65.65.65.65"), 16962));