]> granicus.if.org Git - transmission/commitdiff
Announce -1 as size left if the value is unknown
authorMike Gelfand <mikedld@mikedld.com>
Sun, 30 Apr 2017 18:18:02 +0000 (21:18 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Sun, 30 Apr 2017 18:18:02 +0000 (21:18 +0300)
Fixes: #250
libtransmission/announcer-http.c

index 97f12e5541a84b0a10c1250e5d4bb4ec24a99fef..cabc0c3eed2d72da69480601662f53eb4731c1d7 100644 (file)
@@ -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"
@@ -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");