commit 5aea366f22b0facb7cc3dd2d57906c74cc78b907
parent 911b46d7e5c3319fa623f131cce5d24025a69316
Author: sin <sin@2f30.org>
Date: Sat, 26 Dec 2015 16:56:56 +0000
Add uploaded/downloaded
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/storrent.h b/storrent.h
@@ -56,6 +56,8 @@ struct torrent {
uint32_t *piecebm;
struct peer *peers;
size_t npeers;
+ size_t uploaded;
+ size_t downloaded;
};
/* ben.c */
diff --git a/tracker.c b/tracker.c
@@ -110,10 +110,11 @@ trackerget(struct torrent *t, int event)
}
r = snprintf(buf, sizeof(buf),
- "%s?info_hash=%s&peer_id=%s&port=%d&uploaded=0&"
- "downloaded=0&left=%zu&compact=1&event=%s",
+ "%s?info_hash=%s&peer_id=%s&port=%d&uploaded=%zu&"
+ "downloaded=%zu&left=%zu&compact=1&event=%s",
t->announcers[0].urls[0], infohash, id, PORT,
- t->totallen, ev);
+ t->uploaded, t->downloaded, t->totallen - t->downloaded,
+ ev);
if (r < 0 || (size_t)r >= sizeof(buf)) {
r = -1;
goto err2;