Kaynağa Gözat

Add value queries for total amount up- and downloaded. Use the cached values

for torrent size and amount gotten when the torrent isn't active.
master
Richard Nyberg 18 yıl önce
ebeveyn
işleme
e652eefa26
2 değiştirilmiş dosya ile 12 ekleme ve 2 silme
  1. +10
    -2
      btpd/cli_if.c
  2. +2
    -0
      misc/ipcdefs.h

+ 10
- 2
btpd/cli_if.c Dosyayı Görüntüle

@@ -59,14 +59,14 @@ write_ans(struct io_buffer *iob, struct tlib *tl, enum ipc_tval val)
switch (val) {
case IPC_TVAL_CGOT:
if (tl->tp == NULL)
buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE);
buf_print(iob, "i%dei%llde", IPC_TYPE_NUM, tl->content_have);
else
buf_print(iob, "i%dei%llde", IPC_TYPE_NUM,
(long long)cm_content(tl->tp));
return;
case IPC_TVAL_CSIZE:
if (tl->tp == NULL)
buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE);
buf_print(iob, "i%dei%llde", IPC_TYPE_ERR, tl->content_size);
else
buf_print(iob, "i%dei%llde", IPC_TYPE_NUM,
(long long)tl->tp->total_length);
@@ -168,6 +168,14 @@ write_ans(struct io_buffer *iob, struct tlib *tl, enum ipc_tval val)
}
buf_print(iob, "i%de", ts);
return;
case IPC_TVAL_TOTDWN:
buf_print(iob, "i%dei%llde", IPC_TYPE_NUM, tl->tot_down +
(tl->tp == NULL ? 0 : tl->tp->net->downloaded));
return;
case IPC_TVAL_TOTUP:
buf_print(iob, "i%dei%llde", IPC_TYPE_NUM, tl->tot_up +
(tl->tp == NULL ? 0 : tl->tp->net->uploaded));
return;
case IPC_TVAL_TRERR:
buf_print(iob, "i%dei%ue", IPC_TYPE_NUM,
tl->tp == NULL ? 0 : tr_errors(tl->tp));


+ 2
- 0
misc/ipcdefs.h Dosyayı Görüntüle

@@ -38,6 +38,8 @@ TVDEF(RATEUP, NUM, "rate_up")
TVDEF(SESSDWN, NUM, "sess_down")
TVDEF(SESSUP, NUM, "sess_up")
TVDEF(STATE, TSTATE, "state")
TVDEF(TOTDWN, NUM, "total_down")
TVDEF(TOTUP, NUM, "total_up")
TVDEF(TRERR, NUM, "tr_errors")
#ifdef __IPCTV
#undef __IPCTV


Yükleniyor…
İptal
Kaydet