about summary refs log tree commit diff
path: root/cli
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-02-09 21:59:22 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-02-09 21:59:22 +0000
commitce067525263da9ea08a984b60ba1b1ddfe590179 (patch)
treef8289ca12e6aa9c599e2e4fae9610a34f530f6c6 /cli
parent19b4bf192b5cb5449957c8beece7599e2d96113b (diff)
downloadbtpd-ce067525263da9ea08a984b60ba1b1ddfe590179.tar.gz
btpd-ce067525263da9ea08a984b60ba1b1ddfe590179.zip
Include the info hash in the tpstat structure.
Diffstat (limited to 'cli')
-rw-r--r--cli/btpd_if.c6
-rw-r--r--cli/btpd_if.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/cli/btpd_if.c b/cli/btpd_if.c
index c328fb6..f33851f 100644
--- a/cli/btpd_if.c
+++ b/cli/btpd_if.c
@@ -154,6 +154,7 @@ parse_btstat(const uint8_t *res, struct btstat **out)
     int i = 0;
     for (const char *tp = benc_first(tlst); tp != NULL; tp = benc_next(tp)) {
         struct tpstat *ts = &st->torrents[i];
+        ts->hash = benc_dget_mema(tp, "hash", NULL);
         ts->name = benc_dget_str(tp, "path", NULL);
         ts->state = benc_dget_int(tp, "state");
         ts->errors = benc_dget_int(tp, "errors");
@@ -175,9 +176,12 @@ parse_btstat(const uint8_t *res, struct btstat **out)
 void
 free_btstat(struct btstat *st)
 {
-    for (unsigned i = 0; i < st->ntorrents; i++)
+    for (unsigned i = 0; i < st->ntorrents; i++) {
+        if (st->torrents[i].hash != NULL)
+            free(st->torrents[i].hash);
         if (st->torrents[i].name != NULL)
             free(st->torrents[i].name);
+    }
     free(st);
 }
 
diff --git a/cli/btpd_if.h b/cli/btpd_if.h
index 8c35cc7..b7096aa 100644
--- a/cli/btpd_if.h
+++ b/cli/btpd_if.h
@@ -19,6 +19,7 @@ enum ipc_code {
 struct btstat {
     unsigned ntorrents;
     struct tpstat {
+        uint8_t *hash;
         char *name;
         enum torrent_state state;