diff --git a/btpd/cli_if.c b/btpd/cli_if.c index 56b77fd..ef82d07 100644 --- a/btpd/cli_if.c +++ b/btpd/cli_if.c @@ -100,13 +100,15 @@ write_ans(struct io_buffer *iob, struct tlib *tl, enum ipc_tval val) if (tl->tp == NULL) buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); else - buf_print(iob, "i%dei%lue", IPC_TYPE_NUM, tl->tp->net->rate_dwn); + buf_print(iob, "i%dei%lue", IPC_TYPE_NUM, + tl->tp->net->rate_dwn / RATEHISTORY); return; case IPC_TVAL_RATEUP: if (tl->tp == NULL) buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); else - buf_print(iob, "i%dei%lue", IPC_TYPE_NUM, tl->tp->net->rate_up); + buf_print(iob, "i%dei%lue", IPC_TYPE_NUM, + tl->tp->net->rate_up / RATEHISTORY); return; case IPC_TVAL_SESSDWN: if (tl->tp == NULL) diff --git a/btpd/net.c b/btpd/net.c index 912965c..c6af6ba 100644 --- a/btpd/net.c +++ b/btpd/net.c @@ -523,8 +523,6 @@ net_connection_cb(int sd, short type, void *arg) btpd_log(BTPD_L_CONN, "got connection.\n"); } -#define RATEHISTORY 20 - static unsigned long compute_rate_sub(unsigned long rate) { diff --git a/btpd/net.h b/btpd/net.h index bbc3ceb..e162841 100644 --- a/btpd/net.h +++ b/btpd/net.h @@ -11,6 +11,8 @@ #define MSG_PIECE 7 #define MSG_CANCEL 8 +#define RATEHISTORY 20 + extern struct peer_tq net_unattached; extern struct peer_tq net_bw_readq; extern struct peer_tq net_bw_writeq; diff --git a/cli/stat.c b/cli/stat.c index 96f85c7..0ed75bf 100644 --- a/cli/stat.c +++ b/cli/stat.c @@ -88,9 +88,9 @@ print_stat(struct btstat *st) { print_percent(st->content_got, st->content_size); print_size(st->downloaded); - print_rate(st->rate_down / 20); + print_rate(st->rate_down); print_size(st->uploaded); - print_rate(st->rate_up / 20); + print_rate(st->rate_up); printf("%5u ", st->peers); print_percent(st->pieces_seen, st->torrent_pieces); if (st->tr_errors > 0)