From: George Kadianakis Date: Sat, 16 Apr 2011 12:48:46 +0000 (+0200) Subject: Reuse get_bytes_{read,written}() in status.c X-Git-Tag: tor-0.2.3.1-alpha~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2d9d80a072ab586ba97159f1d401b9ed2980b2d;p=thirdparty%2Ftor.git Reuse get_bytes_{read,written}() in status.c --- diff --git a/src/or/main.c b/src/or/main.c index 9c19485990..6da07bafff 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1923,15 +1923,6 @@ get_uptime(void) return stats_n_seconds_working; } -/** Fills n_read_in with total bytes read and n_written_out - with total bytes written */ -void -get_traffic_stats(uint64_t *n_read_in, uint64_t *n_written_out) -{ - *n_read_in = stats_n_bytes_read; - *n_written_out = stats_n_bytes_written; -} - extern uint64_t rephist_total_alloc; extern uint32_t rephist_total_num; diff --git a/src/or/main.h b/src/or/main.h index ca3f641cef..67c3bb3500 100644 --- a/src/or/main.h +++ b/src/or/main.h @@ -52,7 +52,6 @@ void ip_address_changed(int at_interface); void dns_servers_relaunch_checks(void); long get_uptime(void); -void get_traffic_stats(uint64_t *in, uint64_t *out); void control_signal_act(int the_signal); void handle_signals(int is_parent); diff --git a/src/or/status.c b/src/or/status.c index 054567f4b7..3a51c8b0a7 100644 --- a/src/or/status.c +++ b/src/or/status.c @@ -78,7 +78,6 @@ bytes_to_usage(uint64_t bytes) int log_heartbeat(time_t now) { - uint64_t in,out; char *bw_sent = NULL; char *bw_rcvd = NULL; char *uptime = NULL; @@ -99,10 +98,9 @@ log_heartbeat(time_t now) "in the cached consensus."); } - get_traffic_stats(&in, &out); uptime = secs_to_uptime(get_uptime()); - bw_sent = bytes_to_usage(out); - bw_rcvd = bytes_to_usage(in); + bw_rcvd = bytes_to_usage(get_bytes_read()); + bw_sent = bytes_to_usage(get_bytes_written()); log_fn(LOG_NOTICE, LD_HEARTBEAT, "Heartbeat: Tor's uptime is %s, with %d " "circuits open. I've pushed %s and received %s.",