about summary refs log tree commit diff
path: root/cli
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2009-01-26 22:04:37 +0100
committerRichard Nyberg <rnyberg@murmeldjur.se>2009-01-26 22:15:10 +0100
commita32c7814ccdf310a91c3f16ed32ae90f87424efe (patch)
tree41f6c6c492ea3075a24bd19dcacec1fbbeaf1ba5 /cli
parent3273c5c1b233bd34daca1fff603da70bc5db6441 (diff)
downloadbtpd-a32c7814ccdf310a91c3f16ed32ae90f87424efe.tar.gz
btpd-a32c7814ccdf310a91c3f16ed32ae90f87424efe.zip
Show tracker counts in btcli stat.
The counts are for "reachable" trackers, ie. trackers that haven't
timed out or been disabled for one reason or other.
Diffstat (limited to 'cli')
-rw-r--r--cli/stat.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/cli/stat.c b/cli/stat.c
index 6d3b517..b4ad898 100644
--- a/cli/stat.c
+++ b/cli/stat.c
@@ -28,7 +28,7 @@ usage_stat(void)
 struct btstat {
     unsigned num;
     enum ipc_tstate state;
-    unsigned peers, tr_errors;
+    unsigned peers, tr_good;
     long long content_got, content_size, downloaded, uploaded, rate_up,
         rate_down, tot_up;
     uint32_t pieces_seen, torrent_pieces;
@@ -44,7 +44,7 @@ static enum ipc_tval stkeys[] = {
     IPC_TVAL_NUM,
     IPC_TVAL_NAME,
     IPC_TVAL_PCOUNT,
-    IPC_TVAL_TRERR,
+    IPC_TVAL_TRGOOD,
     IPC_TVAL_PCCOUNT,
     IPC_TVAL_PCSEEN,
     IPC_TVAL_SESSUP,
@@ -69,8 +69,7 @@ print_stat(struct btstat *st)
     print_ratio(st->tot_up, st->content_size);
     printf("%4u ", st->peers);
     print_percent(st->pieces_seen, st->torrent_pieces);
-    if (st->tr_errors > 0)
-        printf("E%u", st->tr_errors);
+    printf("%3u", st->tr_good);
     printf("\n");
 }
 
@@ -94,8 +93,7 @@ stat_cb(int obji, enum ipc_err objerr, struct ipc_get_res *res, void *arg)
     tot->rate_up += (st.rate_up = res[IPC_TVAL_RATEUP].v.num);
     tot->peers += (st.peers = res[IPC_TVAL_PCOUNT].v.num);
     tot->tot_up += (st.tot_up = res[IPC_TVAL_TOTUP].v.num);
-    if ((st.tr_errors = res[IPC_TVAL_TRERR].v.num) > 0)
-        tot->tr_errors++;
+    tot->tr_good += (st.tr_good = res[IPC_TVAL_TRGOOD].v.num);
     if (cba->individual) {
         if (cba->names)
             printf("%.*s\n", (int)res[IPC_TVAL_NAME].v.str.l,
@@ -125,7 +123,7 @@ again:
         } else
             header = 20;
         printf("  HAVE   DLOAD      RTDWN   ULOAD       RTUP   RATIO CONN"
-            "  AVAIL\n");
+            "  AVAIL  TR\n");
     }
 
     bzero(&cba.tot, sizeof(cba.tot));