torrentd

simple torrent daemon
git clone git@git.2f30.org/torrentd.git
Log | Files | Refs | LICENSE

commit 2955d38f0ef209aa43ef5dcef04c8fb0fc287028
parent 8c36138e5b23b9b8bf9bbdb37afdddb64cdd0f0e
Author: sin <sin@2f30.org>
Date:   Sun, 27 Dec 2015 17:59:10 +0000

keep torrents in a list

Diffstat:
Mtorrentd.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/torrentd.c b/torrentd.c @@ -20,6 +20,7 @@ #include <curl/curl.h> +#include "queue.h" #include "sha1.h" #define PORT 49155 @@ -85,7 +86,9 @@ struct torrent { size_t npeers; size_t uploaded; size_t downloaded; + TAILQ_ENTRY(torrent) entry; }; +TAILQ_HEAD(torrenthead, torrent) torrenthead; /* util functions */ void *emalloc(size_t); @@ -1012,6 +1015,7 @@ loadtorrent(char *f) calcinfohash(t); + TAILQ_INSERT_TAIL(&torrenthead, t, entry); return t; fail: unloadtorrent(t); @@ -1212,6 +1216,7 @@ main(int argc, char *argv[]) if (argc != 2) usage(argv[0]); + TAILQ_INIT(&torrenthead); if (!(t = loadtorrent(argv[1]))) exit(1); dumptorrent(t);