Просмотр исходного кода

Include the info hash in the tpstat structure.

master
Richard Nyberg 18 лет назад
Родитель
Сommit
ce06752526
2 измененных файлов: 6 добавлений и 1 удалений
  1. +5
    -1
      cli/btpd_if.c
  2. +1
    -0
      cli/btpd_if.h

+ 5
- 1
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);
}



+ 1
- 0
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;



Загрузка…
Отмена
Сохранить