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/hs_stats.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/hs_stats.c')
-rw-r--r-- | src/or/hs_stats.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/or/hs_stats.c b/src/or/hs_stats.c new file mode 100644 index 0000000000..3e183a5bfc --- /dev/null +++ b/src/or/hs_stats.c @@ -0,0 +1,58 @@ +/* Copyright (c) 2016-2018, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * \file hs_stats.c + * \brief Keeps stats about the activity of our hidden service. + **/ + +#include "or.h" +#include "hs_stats.h" +#include "hs_service.h" + +/** Number of v3 INTRODUCE2 cells received */ +static uint32_t n_introduce2_v3 = 0; +/** Number of v2 INTRODUCE2 cells received */ +static uint32_t n_introduce2_v2 = 0; +/** Number of attempts to make a circuit to a rendezvous point */ +static uint32_t n_rendezvous_launches = 0; + +/** Note that we received another INTRODUCE2 cell. */ +void +hs_stats_note_introduce2_cell(int is_hsv3) +{ + if (is_hsv3) { + n_introduce2_v3++; + } else { + n_introduce2_v2++; + } +} + +/** Return the number of v3 INTRODUCE2 cells we have received. */ +uint32_t +hs_stats_get_n_introduce2_v3_cells(void) +{ + return n_introduce2_v3; +} + +/** Return the number of v2 INTRODUCE2 cells we have received. */ +uint32_t +hs_stats_get_n_introduce2_v2_cells(void) +{ + return n_introduce2_v2; +} + +/** Note that we attempted to launch another circuit to a rendezvous point */ +void +hs_stats_note_service_rendezvous_launch(void) +{ + n_rendezvous_launches++; +} + +/** Return the number of rendezvous circuits we have attempted to launch */ +uint32_t +hs_stats_get_n_rendezvous_launches(void) +{ + return n_rendezvous_launches; +} + |