libeech

BitTorrent library
git clone git://z3bra.org/libeech.git
Log | Files | Refs | README | LICENSE

commit 1dbca24f67c51c35b0ea0c3b7e2d98b85eec5005
parent 565c2cd5e1797bdab81b3f82bcc5af1033330aaf
Author: z3bra <contactatz3bradotorg>
Date:   Sun Oct 22 10:40:18 +0200

Save torrent size

Diffstat:
libeech.c | 4++--
torrent.c | 1+
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libeech.c b/libeech.c @@ -40,8 +40,7 @@ torrentsize(struct torrent *t) long l, sz = 0; struct be info, file; - if (bekv(&t->be, "info", 4, &info) < 0) - return -1; + bekv(&t->be, "info", 4, &info); if (!bekv(&info, "files", 5, &file)) { for (i = 0; !belistnext(&file) && !belistover(&file); i++) { l = bekint(&file, "length", 6); @@ -128,6 +127,7 @@ glch_loadtorrent(struct torrent *t, char *b, size_t s) t->ul = 0; t->dl = 0; + t->sz = torrentsize(t); return 0; } diff --git a/torrent.c b/torrent.c @@ -57,6 +57,7 @@ main(int argc, char *argv[]) printf("Peer ID: %s\n", t.id); printf("Tracker: %s\n", t.tr); + printf("Length: %ld bytes\n", t.sz); return 0; }