deprecate resolve-countries
This commit is contained in:
parent
87dcd690d8
commit
645b121df6
|
@ -25,12 +25,14 @@ boost::int64_t get_download_queue_time(peer_info const& pi)
|
|||
return total_seconds(pi.download_queue_time);
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
str get_country(peer_info const& pi)
|
||||
{
|
||||
return str(pi.country, 2);
|
||||
}
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
tuple get_local_endpoint(peer_info const& pi)
|
||||
{
|
||||
|
@ -85,13 +87,11 @@ void bind_peer_info()
|
|||
.def_readonly("receive_buffer_size", &peer_info::receive_buffer_size)
|
||||
.def_readonly("used_receive_buffer", &peer_info::used_receive_buffer)
|
||||
.def_readonly("num_hashfails", &peer_info::num_hashfails)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
.add_property("country", get_country)
|
||||
#endif
|
||||
#ifndef TORRENT_DISABLE_GEO_IP
|
||||
.def_readonly("inet_as_name", &peer_info::inet_as_name)
|
||||
.def_readonly("inet_as", &peer_info::inet_as)
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
.def_readonly("download_queue_length", &peer_info::download_queue_length)
|
||||
.def_readonly("upload_queue_length", &peer_info::upload_queue_length)
|
||||
.def_readonly("failcount", &peer_info::failcount)
|
||||
|
|
|
@ -388,10 +388,13 @@ void bind_torrent_handle()
|
|||
void (torrent_handle::*rename_file1)(int, std::wstring const&) const = &torrent_handle::rename_file;
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
bool (torrent_handle::*resolve_countries0)() const = &torrent_handle::resolve_countries;
|
||||
void (torrent_handle::*resolve_countries1)(bool) = &torrent_handle::resolve_countries;
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
#define _ allow_threads
|
||||
|
||||
|
@ -429,12 +432,13 @@ void bind_torrent_handle()
|
|||
.def("queue_position_top", _(&torrent_handle::queue_position_top))
|
||||
.def("queue_position_bottom", _(&torrent_handle::queue_position_bottom))
|
||||
|
||||
// deprecated
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// resolve countries deprecated in 1.1
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
.def("resolve_countries", _(resolve_countries0))
|
||||
.def("resolve_countries", _(resolve_countries1))
|
||||
#endif
|
||||
// deprecated
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def("get_torrent_info", &get_torrent_info)
|
||||
.def("super_seeding", super_seeding0)
|
||||
.def("filter_piece", _(&torrent_handle::filter_piece))
|
||||
|
@ -466,7 +470,7 @@ void bind_torrent_handle()
|
|||
.def("save_resume_data", _(&torrent_handle::save_resume_data), arg("flags") = 0)
|
||||
.def("need_save_resume_data", _(&torrent_handle::need_save_resume_data))
|
||||
.def("force_reannounce", _(force_reannounce0)
|
||||
, (arg("seconds") = 0, arg("tracker_idx") = -1))
|
||||
, (arg("seconds") = 0, arg("tracker_idx") = -1))
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
.def("force_dht_announce", _(&torrent_handle::force_dht_announce))
|
||||
#endif
|
||||
|
|
|
@ -433,9 +433,6 @@ int print_peer_info(std::string& out
|
|||
if (print_timers) out += "inactive wait timeout q-time ";
|
||||
out += " v disk ^ rtt ";
|
||||
if (print_block) out += "block-progress ";
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
out += "country ";
|
||||
#endif
|
||||
if (print_peer_rate) out += "peer-rate est.rec.rate ";
|
||||
out += "client \x1b[K\n";
|
||||
++pos;
|
||||
|
@ -556,17 +553,6 @@ int print_peer_info(std::string& out
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
if (i->country[0] == 0)
|
||||
{
|
||||
out += " ..";
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(str, sizeof(str), " %c%c", i->country[0], i->country[1]);
|
||||
out += str;
|
||||
}
|
||||
#endif
|
||||
if (print_peer_rate)
|
||||
{
|
||||
bool unchoked = (i->flags & peer_info::choked) == 0;
|
||||
|
@ -1039,9 +1025,6 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
h.set_max_uploads(-1);
|
||||
h.set_upload_limit(torrent_upload_limit);
|
||||
h.set_download_limit(torrent_download_limit);
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
h.resolve_countries(true);
|
||||
#endif
|
||||
|
||||
// if we have a peer specified, connect to it
|
||||
if (!peer.empty())
|
||||
|
|
|
@ -672,6 +672,7 @@ namespace libtorrent
|
|||
, void* userdata = NULL, block_cache_reference ref
|
||||
= block_cache_reference());
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
void set_country(char const* c)
|
||||
{
|
||||
|
@ -681,6 +682,7 @@ namespace libtorrent
|
|||
}
|
||||
bool has_country() const { return m_country[0] != 0; }
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
int outstanding_bytes() const { return m_outstanding_bytes; }
|
||||
|
||||
|
@ -1112,6 +1114,7 @@ namespace libtorrent
|
|||
// TODO: 2 rename this target queue size
|
||||
boost::uint16_t m_desired_queue_size;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
// in case the session settings is set
|
||||
// to resolve countries, this is set to
|
||||
|
@ -1119,6 +1122,7 @@ namespace libtorrent
|
|||
// peer resides in.
|
||||
char m_country[2];
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
// if set to non-zero, this peer will always prefer
|
||||
// to request entire n pieces, rather than blocks.
|
||||
|
|
|
@ -46,10 +46,6 @@ namespace libtorrent
|
|||
// that libtorrent is connected to
|
||||
struct TORRENT_EXPORT peer_info
|
||||
{
|
||||
// the name of the AS this peer is located in. This might be an empty
|
||||
// string if there is no name in the geo ip database.
|
||||
std::string inet_as_name;
|
||||
|
||||
// a string describing the software at the other end of the connection.
|
||||
// In some cases this information is not available, then it will contain
|
||||
// a string that may give away something about which software is running
|
||||
|
@ -255,9 +251,6 @@ namespace libtorrent
|
|||
// turned out to fail the hash check.
|
||||
int num_hashfails;
|
||||
|
||||
// the AS number the peer is located in.
|
||||
int inet_as;
|
||||
|
||||
// this is the number of requests we have sent to this peer that we
|
||||
// haven't got a response for yet
|
||||
int download_queue_length;
|
||||
|
@ -349,7 +342,7 @@ namespace libtorrent
|
|||
// are given in bytes per second. This number is reset to 0 on reconnect.
|
||||
int download_rate_peak;
|
||||
int upload_rate_peak;
|
||||
|
||||
|
||||
// the progress of the peer in the range [0, 1]. This is always 0 when
|
||||
// floating point operations are diabled, instead use ``progress_ppm``.
|
||||
float progress; // [0, 1]
|
||||
|
@ -378,7 +371,7 @@ namespace libtorrent
|
|||
// bits for the read_state and write_state
|
||||
enum bw_state
|
||||
{
|
||||
// The peer is not waiting for any external events to
|
||||
// The peer is not waiting for any external events to
|
||||
// send or receive data.
|
||||
bw_idle = 0,
|
||||
|
||||
|
@ -405,6 +398,9 @@ namespace libtorrent
|
|||
char read_state;
|
||||
char write_state;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// country code deprecated in 1.1
|
||||
|
||||
// the two letter `ISO 3166 country code`__ for the country the peer is
|
||||
// connected from. If the country hasn't been resolved yet, both chars
|
||||
// are set to 0. If the resolution failed for some reason, the field is
|
||||
|
@ -416,7 +412,6 @@ namespace libtorrent
|
|||
// __ http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
|
||||
char country[2];
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// the number of bytes per second we are allowed to send to or receive
|
||||
// from this peer. It may be -1 if there's no local limit on the peer.
|
||||
// The global limit and the torrent limit may also be enforced.
|
||||
|
|
|
@ -560,6 +560,9 @@ namespace libtorrent
|
|||
state_updated();
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
void resolve_countries(bool r);
|
||||
bool resolving_countries() const;
|
||||
|
@ -569,6 +572,7 @@ namespace libtorrent
|
|||
, std::vector<address> const& host_list
|
||||
, boost::shared_ptr<peer_connection> p) const;
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
// --------------------------------------------
|
||||
// BANDWIDTH MANAGEMENT
|
||||
|
|
|
@ -835,13 +835,19 @@ namespace libtorrent
|
|||
void queue_position_top() const;
|
||||
void queue_position_bottom() const;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
|
||||
// Sets or gets the flag that derermines if countries should be resolved
|
||||
// for the peers of this torrent. It defaults to false. If it is set to
|
||||
// true, the peer_info structure for the peers in this torrent will have
|
||||
// their ``country`` member set. See peer_info for more information on
|
||||
// how to interpret this field.
|
||||
TORRENT_DEPRECATED
|
||||
void resolve_countries(bool r);
|
||||
TORRENT_DEPRECATED
|
||||
bool resolve_countries() const;
|
||||
#endif
|
||||
|
||||
// For SSL torrents, use this to specify a path to a .pem file to use as
|
||||
// this client's certificate. The certificate must be signed by the
|
||||
|
|
|
@ -217,9 +217,11 @@ namespace libtorrent
|
|||
m_quota[1] = 0;
|
||||
|
||||
TORRENT_ASSERT(pack.peerinfo == 0 || pack.peerinfo->banned == false);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
std::fill(m_country, m_country + 2, 0);
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
error_code ec;
|
||||
TORRENT_ASSERT(m_socket->remote_endpoint(ec) == m_remote || ec);
|
||||
|
@ -4388,13 +4390,15 @@ namespace libtorrent
|
|||
|
||||
p.download_queue_time = download_queue_time();
|
||||
p.queue_bytes = m_outstanding_bytes;
|
||||
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
p.country[0] = m_country[0];
|
||||
p.country[1] = m_country[1];
|
||||
#else
|
||||
std::fill(p.country, p.country + 2, 0);
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
p.total_download = statistics().total_payload_download();
|
||||
p.total_upload = statistics().total_payload_upload();
|
||||
|
@ -4457,16 +4461,12 @@ namespace libtorrent
|
|||
p.num_hashfails = pi->hashfails;
|
||||
p.flags |= pi->on_parole ? peer_info::on_parole : 0;
|
||||
p.flags |= pi->optimistically_unchoked ? peer_info::optimistic_unchoke : 0;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
p.inet_as = 0xffff;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
p.source = 0;
|
||||
p.failcount = 0;
|
||||
p.num_hashfails = 0;
|
||||
p.inet_as = 0xffff;
|
||||
}
|
||||
|
||||
p.remote_dl_rate = m_remote_dl_rate;
|
||||
|
|
|
@ -238,9 +238,11 @@ namespace libtorrent
|
|||
, m_seed_mode(false)
|
||||
, m_super_seeding(false)
|
||||
, m_override_resume_data((p.flags & add_torrent_params::flag_override_resume_data) != 0)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
, m_resolving_country(false)
|
||||
, m_resolve_countries(false)
|
||||
#endif
|
||||
#endif
|
||||
, m_need_save_resume_data(true)
|
||||
, m_seeding_time(0)
|
||||
|
@ -6599,7 +6601,7 @@ namespace libtorrent
|
|||
, boost::int64_t(web->peer_info.prev_amount_upload) << 10);
|
||||
web->peer_info.prev_amount_download = 0;
|
||||
web->peer_info.prev_amount_upload = 0;
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
debug_log("web seed connection started: [%s] %s"
|
||||
, print_endpoint(a).c_str(), web->url.c_str());
|
||||
#endif
|
||||
|
@ -6624,6 +6626,8 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
namespace
|
||||
{
|
||||
|
@ -6749,7 +6753,7 @@ namespace libtorrent
|
|||
int idx = 0;
|
||||
while (idx < host_list.size() && !host_list[idx].is_v4())
|
||||
++idx;
|
||||
|
||||
|
||||
if (idx >= host_list.size())
|
||||
{
|
||||
p->set_country("--");
|
||||
|
@ -6758,7 +6762,7 @@ namespace libtorrent
|
|||
|
||||
// country is an ISO 3166 country code
|
||||
int country = host_list[idx].to_v4().to_ulong() & 0xffff;
|
||||
|
||||
|
||||
// look up the country code in the map
|
||||
const int size = sizeof(country_map)/sizeof(country_map[0]);
|
||||
country_entry tmp = {country, ""};
|
||||
|
@ -6780,6 +6784,7 @@ namespace libtorrent
|
|||
p->set_country(j->name);
|
||||
}
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
void torrent::read_resume_data(bdecode_node const& rd)
|
||||
{
|
||||
|
@ -7449,10 +7454,13 @@ namespace libtorrent
|
|||
peer_info& p = v.back();
|
||||
|
||||
peer->get_peer_info(p);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
if (resolving_countries())
|
||||
resolve_peer_country(peer->self());
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -810,6 +810,7 @@ namespace libtorrent
|
|||
TORRENT_ASYNC_CALL1(super_seeding, on);
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void torrent_handle::resolve_countries(bool r)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
|
@ -826,6 +827,7 @@ namespace libtorrent
|
|||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
void torrent_handle::get_full_peer_list(std::vector<peer_list_entry>& v) const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue