Skip to content

Commit

Permalink
Announce -1 as size left if the value is unknown
Browse files Browse the repository at this point in the history
Fixes: #250
  • Loading branch information
mikedld committed Apr 30, 2017
1 parent efaa9d0 commit ac4fa04
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libtransmission/announcer-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static char* announce_url_new(tr_session const* session, tr_announce_request con
"&port=%d"
"&uploaded=%" PRIu64
"&downloaded=%" PRIu64
"&left=%" PRIu64
"&numwant=%d"
"&key=%x"
"&compact=1"
Expand All @@ -86,10 +85,19 @@ static char* announce_url_new(tr_session const* session, tr_announce_request con
req->port,
req->up,
req->down,
req->leftUntilComplete,
req->numwant,
req->key);

if (req->leftUntilComplete != ~(uint64_t)0)
{
evbuffer_add_printf(buf, "&left=%" PRIu64, req->leftUntilComplete);
}
else
{
// Support trackers which don't react to huge numbers well (e.g. Amazon S3)
evbuffer_add_printf(buf, "&left=-1");
}

if (session->encryptionMode == TR_ENCRYPTION_REQUIRED)
{
evbuffer_add_printf(buf, "&requirecrypto=1");
Expand Down

0 comments on commit ac4fa04

Please sign in to comment.