mirror of
https://github.com/transmission/transmission
synced 2025-01-01 20:45:14 +00:00
Announce INT64_MAX as size left if the value is unknown
This helps with trakers like Amazon S3 where signed type is used but negative values aren't accepted. Fixes: #250
This commit is contained in:
parent
ac4fa04277
commit
6a74bd438c
2 changed files with 3 additions and 11 deletions
|
@ -74,6 +74,7 @@ static char* announce_url_new(tr_session const* session, tr_announce_request con
|
||||||
"&port=%d"
|
"&port=%d"
|
||||||
"&uploaded=%" PRIu64
|
"&uploaded=%" PRIu64
|
||||||
"&downloaded=%" PRIu64
|
"&downloaded=%" PRIu64
|
||||||
|
"&left=%" PRIu64
|
||||||
"&numwant=%d"
|
"&numwant=%d"
|
||||||
"&key=%x"
|
"&key=%x"
|
||||||
"&compact=1"
|
"&compact=1"
|
||||||
|
@ -85,19 +86,10 @@ static char* announce_url_new(tr_session const* session, tr_announce_request con
|
||||||
req->port,
|
req->port,
|
||||||
req->up,
|
req->up,
|
||||||
req->down,
|
req->down,
|
||||||
|
req->leftUntilComplete,
|
||||||
req->numwant,
|
req->numwant,
|
||||||
req->key);
|
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)
|
if (session->encryptionMode == TR_ENCRYPTION_REQUIRED)
|
||||||
{
|
{
|
||||||
evbuffer_add_printf(buf, "&requirecrypto=1");
|
evbuffer_add_printf(buf, "&requirecrypto=1");
|
||||||
|
|
|
@ -945,7 +945,7 @@ static tr_announce_request* announce_request_new(tr_announcer const* announcer,
|
||||||
req->up = tier->byteCounts[TR_ANN_UP];
|
req->up = tier->byteCounts[TR_ANN_UP];
|
||||||
req->down = tier->byteCounts[TR_ANN_DOWN];
|
req->down = tier->byteCounts[TR_ANN_DOWN];
|
||||||
req->corrupt = tier->byteCounts[TR_ANN_CORRUPT];
|
req->corrupt = tier->byteCounts[TR_ANN_CORRUPT];
|
||||||
req->leftUntilComplete = tr_torrentHasMetadata(tor) ? tor->info.totalSize - tr_torrentHaveTotal(tor) : ~(uint64_t)0;
|
req->leftUntilComplete = tr_torrentHasMetadata(tor) ? tor->info.totalSize - tr_torrentHaveTotal(tor) : INT64_MAX;
|
||||||
req->event = event;
|
req->event = event;
|
||||||
req->numwant = event == TR_ANNOUNCE_EVENT_STOPPED ? 0 : NUMWANT;
|
req->numwant = event == TR_ANNOUNCE_EVENT_STOPPED ? 0 : NUMWANT;
|
||||||
req->key = announcer->key;
|
req->key = announcer->key;
|
||||||
|
|
Loading…
Reference in a new issue