torrentd

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

commit fdbdc988faebba9dd9bd46b11f24ee9789a88836
parent 7b53475a10574bd55f878856a531227df940aabb
Author: sin <sin@2f30.org>
Date:   Fri, 18 Dec 2015 15:23:37 +0000

More updates to torrent.c

Diffstat:
Msbtd.h | 2++
Mtorrent.c | 7+++++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sbtd.h b/sbtd.h @@ -30,7 +30,9 @@ struct torrent { size_t buflen; struct ben *ben; struct ben *info; + struct ben *pieces; char *announce; + char *filename; uint8_t infohash[20]; long long length; long long piecelen; diff --git a/torrent.c b/torrent.c @@ -67,6 +67,13 @@ loadtorrent(char *f) } t->announce = bstr2str(dlookstr(t->ben, "announce")); + if (!dlookstr(t->info, "name")) { + warnx("no filename field in %s", f); + goto err2; + } + t->filename = bstr2str(dlookstr(t->info, "name")); + puts(t->filename); + if (!dlookstr(t->info, "length")) { warnx("no length field in %s", f); goto err2;