torrentd

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

commit 89709afc547df11b28a1ce14a268c1afe78207b6
parent b84463502c6806ff07078402d6123067f5eeb597
Author: sin <sin@2f30.org>
Date:   Sat, 26 Dec 2015 16:44:05 +0000

check for failure reason

Diffstat:
Mtracker.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tracker.c b/tracker.c @@ -52,11 +52,19 @@ parsepeers(struct torrent *t, struct buf *b) struct sockaddr_in sa; struct ben *reply, *peers; struct peer *peer; - char *p; + char *p, *errstr; if (!bdecode(b->p, b->p + b->n, &reply)) return -1; + if (dlookstr(reply, "failure reason")) { + errstr = bstr2str(dlookstr(reply, "failure reason")); + warnx("tracker failure: %s", errstr); + bfree(reply); + free(errstr); + return -1; + } + if (!(peers = dlookstr(reply, "peers"))) { warnx("no peers field in tracker reply"); bfree(reply);