support option to report redundant bytes or not to tracker as well as 'corrupt' argument
This commit is contained in:
parent
e71f70a98d
commit
04d31cea6e
|
@ -118,6 +118,7 @@ release 0.14.9
|
|||
* fixed MinGW support
|
||||
* fixed DHT bootstrapping issue
|
||||
* fixed UDP over SOCKS5 issue
|
||||
* added support for "corrupt" tracker announce
|
||||
|
||||
release 0.14.8
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ void bind_session_settings()
|
|||
.def_readwrite("increase_est_reciprocation_rate", &session_settings::increase_est_reciprocation_rate)
|
||||
.def_readwrite("decrease_est_reciprocation_rate", &session_settings::decrease_est_reciprocation_rate)
|
||||
.def_readwrite("incoming_starts_queued_torrents", &session_settings::incoming_starts_queued_torrents)
|
||||
.def_readwrite("report_true_downoaded", &session_settings::report_true_downloaded)
|
||||
;
|
||||
|
||||
enum_<proxy_settings::proxy_type>("proxy_type")
|
||||
|
|
|
@ -3772,6 +3772,7 @@ session_settings
|
|||
int increase_est_reciprocation_rate;
|
||||
int decrease_est_reciprocation_rate;
|
||||
bool incoming_starts_queued_torrents;
|
||||
bool report_true_downloaded;
|
||||
};
|
||||
|
||||
``user_agent`` this is the client identification to the tracker.
|
||||
|
@ -4343,6 +4344,10 @@ avoid spreading one's unchoke slots too thin. If a peer managed to
|
|||
find us, even though we're no in the torrent anymore, this setting
|
||||
can make us start the torrent and serve it.
|
||||
|
||||
When ``report_true_downloaded`` is true, the ``&downloaded=`` argument
|
||||
sent to trackers will include redundant downloaded bytes. It defaults
|
||||
to ``false``, which means redundant bytes are not reported to the tracker.
|
||||
|
||||
pe_settings
|
||||
===========
|
||||
|
||||
|
|
|
@ -202,6 +202,7 @@ namespace libtorrent
|
|||
, increase_est_reciprocation_rate(20)
|
||||
, decrease_est_reciprocation_rate(3)
|
||||
, incoming_starts_queued_torrents(false)
|
||||
, report_true_downloaded(false)
|
||||
{}
|
||||
|
||||
// this is the user agent that will be sent to the tracker
|
||||
|
@ -762,6 +763,12 @@ namespace libtorrent
|
|||
// if set to true, an incoming connection to a torrent that's
|
||||
// paused and auto-managed will make the torrent start.
|
||||
bool incoming_starts_queued_torrents;
|
||||
|
||||
// when set to true, the downloaded counter sent to trackers
|
||||
// will include the actual number of payload bytes donwnloaded
|
||||
// including redundant bytes. If set to false, it will not include
|
||||
// any redundany bytes
|
||||
bool report_true_downloaded;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace libtorrent
|
|||
size_type downloaded;
|
||||
size_type uploaded;
|
||||
size_type left;
|
||||
size_type corrupt;
|
||||
unsigned short listen_port;
|
||||
event_t event;
|
||||
std::string url;
|
||||
|
|
|
@ -139,7 +139,8 @@ namespace libtorrent
|
|||
char str[1024];
|
||||
const bool stats = tracker_req().send_stats;
|
||||
snprintf(str, sizeof(str), "&peer_id=%s&port=%d&uploaded=%"PRId64
|
||||
"&downloaded=%"PRId64"&left=%"PRId64"&compact=1&numwant=%d&key=%x&no_peer_id=1"
|
||||
"&downloaded=%"PRId64"&left=%"PRId64"&corrupt="PRId64"&compact=1"
|
||||
"&numwant=%d&key=%x&no_peer_id=1"
|
||||
, escape_string((const char*)&tracker_req().pid[0], 20).c_str()
|
||||
// the i2p tracker seems to verify that the port is not 0,
|
||||
// even though it ignores it otherwise
|
||||
|
@ -147,6 +148,7 @@ namespace libtorrent
|
|||
, stats ? tracker_req().uploaded : 0
|
||||
, stats ? tracker_req().downloaded : 0
|
||||
, stats ? tracker_req().left : 0
|
||||
, stats ? tracker_req().corrupt : 0
|
||||
, tracker_req().num_want
|
||||
, tracker_req().key);
|
||||
url += str;
|
||||
|
|
|
@ -1345,10 +1345,16 @@ namespace libtorrent
|
|||
tracker_request req;
|
||||
req.info_hash = m_torrent_file->info_hash();
|
||||
req.pid = m_ses.get_peer_id();
|
||||
req.downloaded = m_stat.total_payload_download();
|
||||
req.downloaded = m_stat.total_payload_download() - m_total_failed_bytes;
|
||||
req.uploaded = m_stat.total_payload_upload();
|
||||
req.corrupt = m_total_failed_bytes;
|
||||
req.left = bytes_left();
|
||||
if (req.left == -1) req.left = 16*1024;
|
||||
|
||||
// exclude redundant bytes if we should
|
||||
if (!settings().report_true_downloaded)
|
||||
req.downloaded -= m_total_redundant_bytes;
|
||||
|
||||
req.event = e;
|
||||
error_code ec;
|
||||
tcp::endpoint ep;
|
||||
|
@ -5327,10 +5333,16 @@ namespace libtorrent
|
|||
// tell the tracker that we're back
|
||||
std::for_each(m_trackers.begin(), m_trackers.end()
|
||||
, bind(&announce_entry::reset, _1));
|
||||
m_stat.clear();
|
||||
announce_with_tracker();
|
||||
}
|
||||
|
||||
// reset the stats, since from the tracker's
|
||||
// point of view, this is a new session
|
||||
m_total_failed_bytes = 0;
|
||||
m_total_redundant_bytes = 0;
|
||||
m_stat.clear();
|
||||
|
||||
announce_with_tracker();
|
||||
|
||||
// private torrents are never announced on LSD
|
||||
// or on DHT, we don't need this timer.
|
||||
if (!m_torrent_file->is_valid()
|
||||
|
|
Loading…
Reference in New Issue