don't send stats to trackers received through tracker exchange

This commit is contained in:
Arvid Norberg
2009-09-25 18:17:59 +00:00
parent 6eefa02c56
commit 9b15c11740
6 changed files with 18 additions and 6 deletions

View File

@@ -137,15 +137,16 @@ namespace libtorrent
if (tracker_req().kind == tracker_request::announce_request)
{
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"
, 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
, i2p ? 1 : tracker_req().listen_port
, tracker_req().uploaded
, tracker_req().downloaded
, tracker_req().left
, stats ? tracker_req().uploaded : 0
, stats ? tracker_req().downloaded : 0
, stats ? tracker_req().left : 0
, tracker_req().num_want
, tracker_req().key);
url += str;