not need to know about the sample time.master
@@ -100,13 +100,15 @@ write_ans(struct io_buffer *iob, struct tlib *tl, enum ipc_tval val) | |||||
if (tl->tp == NULL) | if (tl->tp == NULL) | ||||
buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); | buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); | ||||
else | 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; | return; | ||||
case IPC_TVAL_RATEUP: | case IPC_TVAL_RATEUP: | ||||
if (tl->tp == NULL) | if (tl->tp == NULL) | ||||
buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); | buf_print(iob, "i%dei%de", IPC_TYPE_ERR, IPC_ETINACTIVE); | ||||
else | 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; | return; | ||||
case IPC_TVAL_SESSDWN: | case IPC_TVAL_SESSDWN: | ||||
if (tl->tp == NULL) | if (tl->tp == NULL) | ||||
@@ -523,8 +523,6 @@ net_connection_cb(int sd, short type, void *arg) | |||||
btpd_log(BTPD_L_CONN, "got connection.\n"); | btpd_log(BTPD_L_CONN, "got connection.\n"); | ||||
} | } | ||||
#define RATEHISTORY 20 | |||||
static unsigned long | static unsigned long | ||||
compute_rate_sub(unsigned long rate) | compute_rate_sub(unsigned long rate) | ||||
{ | { | ||||
@@ -11,6 +11,8 @@ | |||||
#define MSG_PIECE 7 | #define MSG_PIECE 7 | ||||
#define MSG_CANCEL 8 | #define MSG_CANCEL 8 | ||||
#define RATEHISTORY 20 | |||||
extern struct peer_tq net_unattached; | extern struct peer_tq net_unattached; | ||||
extern struct peer_tq net_bw_readq; | extern struct peer_tq net_bw_readq; | ||||
extern struct peer_tq net_bw_writeq; | extern struct peer_tq net_bw_writeq; | ||||
@@ -88,9 +88,9 @@ print_stat(struct btstat *st) | |||||
{ | { | ||||
print_percent(st->content_got, st->content_size); | print_percent(st->content_got, st->content_size); | ||||
print_size(st->downloaded); | print_size(st->downloaded); | ||||
print_rate(st->rate_down / 20); | |||||
print_rate(st->rate_down); | |||||
print_size(st->uploaded); | print_size(st->uploaded); | ||||
print_rate(st->rate_up / 20); | |||||
print_rate(st->rate_up); | |||||
printf("%5u ", st->peers); | printf("%5u ", st->peers); | ||||
print_percent(st->pieces_seen, st->torrent_pieces); | print_percent(st->pieces_seen, st->torrent_pieces); | ||||
if (st->tr_errors > 0) | if (st->tr_errors > 0) | ||||