diff options
author | George Kadianakis <desnacked@riseup.net> | 2018-01-23 12:31:06 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2018-01-23 12:31:06 +0200 |
commit | 17daab76b87a9cc7491bdfdc46dd10c9d5d7023f (patch) | |
tree | 208b898b50753bd2efb632f47d6fbd1827868879 /src/or/status.c | |
parent | 48a51c5f8b80a359da31bc5aaac8ecd25890fe0d (diff) | |
download | tor-17daab76b87a9cc7491bdfdc46dd10c9d5d7023f.tar.gz tor-17daab76b87a9cc7491bdfdc46dd10c9d5d7023f.zip |
Add onion service activity information to our heartbeat logs.
Diffstat (limited to 'src/or/status.c')
-rw-r--r-- | src/or/status.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/status.c b/src/or/status.c index 1a8885e83e..187dc4ad22 100644 --- a/src/or/status.c +++ b/src/or/status.c @@ -27,6 +27,8 @@ #include "hibernate.h" #include "rephist.h" #include "statefile.h" +#include "hs_stats.h" +#include "hs_service.h" static void log_accounting(const time_t now, const or_options_t *options); #include "geoip.h" @@ -85,6 +87,26 @@ bytes_to_usage(uint64_t bytes) return bw_string; } +/** Log some usage info about our hidden service */ +static void +log_onion_service_stats(void) +{ + unsigned int num_services = hs_service_get_num_services(); + + /* If there are no active hidden services, no need to print logs */ + if (num_services == 0) { + return; + } + + log_notice(LD_HEARTBEAT, + "Our hidden service%s received %u v2 and %u v3 INTRODUCE2 cells " + "and attempted to launch %d rendezvous circuits.", + num_services == 1 ? "" : "s", + hs_stats_get_n_introduce2_v2_cells(), + hs_stats_get_n_introduce2_v3_cells(), + hs_stats_get_n_rendezvous_launches()); +} + /** Log a "heartbeat" message describing Tor's status and history so that the * user can know that there is indeed a running Tor. Return 0 on success and * -1 on failure. */ @@ -171,6 +193,9 @@ log_heartbeat(time_t now) U64_PRINTF_ARG(main_loop_idle_count)); } + /** Now, if we are an HS service, log some stats about our usage */ + log_onion_service_stats(); + tor_free(uptime); tor_free(bw_sent); tor_free(bw_rcvd); |