forked from premiere/premiere-libtorrent
deprecate send_stats property on trackers (since lt_tracker extension has been removed) (#1125)
This commit is contained in:
parent
62536c790d
commit
f712caa80d
|
@ -1,3 +1,5 @@
|
|||
* deprecate "send_stats" property on trackers (since lt_tracker extension has
|
||||
been removed)
|
||||
* remove deprecate session_settings API (use settings_pack instead)
|
||||
* improve file layout optimization when creating torrents with padfiles
|
||||
* remove remote_dl_rate feature
|
||||
|
|
|
@ -200,8 +200,10 @@ void dict_to_announce_entry(dict d, announce_entry& ae)
|
|||
ae.source = extract<int>(d["source"]);
|
||||
if (d.has_key("verified"))
|
||||
ae.verified = extract<bool>(d["verified"]);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
if (d.has_key("send_stats"))
|
||||
ae.send_stats = extract<bool>(d["send_stats"]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void replace_trackers(torrent_handle& h, object trackers)
|
||||
|
@ -258,7 +260,9 @@ list trackers(torrent_handle& h)
|
|||
d["updating"] = i->updating;
|
||||
d["start_sent"] = i->start_sent;
|
||||
d["complete_sent"] = i->complete_sent;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
d["send_stats"] = i->send_stats;
|
||||
#endif
|
||||
ret.append(d);
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -123,9 +123,9 @@ namespace
|
|||
bool get_updating(announce_entry const& ae) { return ae.updating; }
|
||||
bool get_start_sent(announce_entry const& ae) { return ae.start_sent; }
|
||||
bool get_complete_sent(announce_entry const& ae) { return ae.complete_sent; }
|
||||
bool get_send_stats(announce_entry const& ae) { return ae.send_stats; }
|
||||
|
||||
#if !defined TORRENT_NO_DEPRECATE
|
||||
bool get_send_stats(announce_entry const& ae) { return ae.send_stats; }
|
||||
std::int64_t get_size(file_entry const& fe) { return fe.size; }
|
||||
std::int64_t get_offset(file_entry const& fe) { return fe.offset; }
|
||||
std::int64_t get_file_base(file_entry const& fe) { return fe.file_base; }
|
||||
|
@ -295,7 +295,9 @@ void bind_torrent_info()
|
|||
.add_property("updating", &get_updating)
|
||||
.add_property("start_sent", &get_start_sent)
|
||||
.add_property("complete_sent", &get_complete_sent)
|
||||
#if !defined TORRENT_NO_DEPRECATE
|
||||
.add_property("send_stats", &get_send_stats)
|
||||
#endif
|
||||
|
||||
.def("reset", &announce_entry::reset)
|
||||
.def("can_announce", &announce_entry::can_announce)
|
||||
|
|
|
@ -144,8 +144,14 @@ namespace libtorrent
|
|||
// set to true when we send a event=completed.
|
||||
bool complete_sent:1;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.2
|
||||
// this is false the stats sent to this tracker will be 0
|
||||
bool send_stats:1;
|
||||
#else
|
||||
// hidden
|
||||
bool deprecated_send_stats:1;
|
||||
#endif
|
||||
|
||||
// internal
|
||||
bool triggered_manually:1;
|
||||
|
|
|
@ -96,7 +96,6 @@ namespace libtorrent
|
|||
, kind(announce_request)
|
||||
, key(0)
|
||||
, num_want(0)
|
||||
, send_stats(true)
|
||||
, triggered_manually(false)
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
, ssl_ctx(0)
|
||||
|
@ -155,8 +154,6 @@ namespace libtorrent
|
|||
peer_id pid;
|
||||
address bind_ip;
|
||||
|
||||
bool send_stats;
|
||||
|
||||
// this is set to true if this request was triggered by a "manual" call to
|
||||
// scrape_tracker() or force_reannounce()
|
||||
bool triggered_manually;
|
||||
|
|
|
@ -62,7 +62,6 @@ namespace libtorrent
|
|||
, verified(false)
|
||||
, start_sent(false)
|
||||
, complete_sent(false)
|
||||
, send_stats(true)
|
||||
, triggered_manually(false)
|
||||
{}
|
||||
|
||||
|
@ -80,7 +79,6 @@ namespace libtorrent
|
|||
, verified(false)
|
||||
, start_sent(false)
|
||||
, complete_sent(false)
|
||||
, send_stats(true)
|
||||
, triggered_manually(false)
|
||||
{}
|
||||
|
||||
|
|
|
@ -116,7 +116,6 @@ namespace libtorrent
|
|||
const char* event_string[] = {"completed", "started", "stopped", "paused"};
|
||||
|
||||
char str[1024];
|
||||
const bool stats = tracker_req().send_stats;
|
||||
std::snprintf(str, sizeof(str)
|
||||
, "&peer_id=%s"
|
||||
"&port=%d"
|
||||
|
@ -133,10 +132,10 @@ namespace libtorrent
|
|||
// the i2p tracker seems to verify that the port is not 0,
|
||||
// even though it ignores it otherwise
|
||||
, i2p ? 1 : tracker_req().listen_port
|
||||
, stats ? tracker_req().uploaded : 0
|
||||
, stats ? tracker_req().downloaded : 0
|
||||
, stats ? tracker_req().left : 0
|
||||
, stats ? tracker_req().corrupt : 0
|
||||
, tracker_req().uploaded
|
||||
, tracker_req().downloaded
|
||||
, tracker_req().left
|
||||
, tracker_req().corrupt
|
||||
, tracker_req().key
|
||||
, (tracker_req().event != tracker_request::none) ? "&event=" : ""
|
||||
, (tracker_req().event != tracker_request::none) ? event_string[tracker_req().event - 1] : ""
|
||||
|
@ -147,7 +146,7 @@ namespace libtorrent
|
|||
&& settings.get_bool(settings_pack::announce_crypto_support))
|
||||
url += "&supportcrypto=1";
|
||||
#endif
|
||||
if (stats && settings.get_bool(settings_pack::report_redundant_bytes))
|
||||
if (settings.get_bool(settings_pack::report_redundant_bytes))
|
||||
{
|
||||
url += "&redundant=";
|
||||
url += to_string(tracker_req().redundant).data();
|
||||
|
@ -168,7 +167,7 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
{
|
||||
url += "&ip=" + tracker_req ().i2pconn->local_endpoint () + ".i2p";
|
||||
url += "&ip=" + tracker_req().i2pconn->local_endpoint () + ".i2p";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6429,10 +6429,6 @@ namespace libtorrent
|
|||
int tier = 0;
|
||||
for (announce_entry const& tr : m_trackers)
|
||||
{
|
||||
// don't save trackers we can't trust
|
||||
// TODO: 1 save the send_stats state instead of throwing them away
|
||||
// it may pose an issue when downgrading though
|
||||
if (tr.send_stats == false) continue;
|
||||
if (tr.tier == tier)
|
||||
{
|
||||
tr_list.back().list().push_back(tr.url);
|
||||
|
|
|
@ -719,7 +719,6 @@ namespace libtorrent
|
|||
span<char> out = buf;
|
||||
|
||||
tracker_request const& req = tracker_req();
|
||||
bool const stats = req.send_stats;
|
||||
aux::session_settings const& settings = m_man.settings();
|
||||
|
||||
std::map<address, connection_cache_entry>::iterator i
|
||||
|
@ -735,9 +734,9 @@ namespace libtorrent
|
|||
out.subspan(20);
|
||||
std::copy(req.pid.begin(), req.pid.end(), out.data()); // peer_id
|
||||
out.subspan(20);
|
||||
aux::write_int64(stats ? req.downloaded : 0, out); // downloaded
|
||||
aux::write_int64(stats ? req.left : 0, out); // left
|
||||
aux::write_int64(stats ? req.uploaded : 0, out); // uploaded
|
||||
aux::write_int64(req.downloaded, out); // downloaded
|
||||
aux::write_int64(req.left, out); // left
|
||||
aux::write_int64(req.uploaded, out); // uploaded
|
||||
aux::write_int32(req.event, out); // event
|
||||
// ip address
|
||||
address_v4 announce_ip;
|
||||
|
|
Loading…
Reference in New Issue