aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2014-12-02 12:20:35 +0000
committerNick Mathewson <nickm@torproject.org>2014-12-19 10:35:25 -0500
commit14e83e626be84c4f311b8e8f0d80ca141675fa9e (patch)
tree4e15bdc7b247fa007a4fe9a10f558e3a491ba8c4 /src/or/rendcommon.c
parent7cd53b75c10831e01e288b01f63cab069d3e3035 (diff)
downloadtor-14e83e626be84c4f311b8e8f0d80ca141675fa9e.tar.gz
tor-14e83e626be84c4f311b8e8f0d80ca141675fa9e.zip
Add two hidden-service related statistics.
The two statistics are: 1. number of RELAY cells observed on successfully established rendezvous circuits; and 2. number of .onion addresses observed as hidden-service directory. Both statistics are accumulated over 24 hours, obfuscated by rounding up to the next multiple of a given number and adding random noise, and written to local file stats/hidserv-stats. Notably, no statistics will be gathered on clients or services, but only on relays.
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index df74b745a2..e779ecfe90 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -924,6 +924,7 @@ rend_cache_lookup_v2_desc_as_dir(const char *desc_id, const char **desc)
rend_cache_store_status_t
rend_cache_store_v2_desc_as_dir(const char *desc)
{
+ const or_options_t *options = get_options();
rend_service_descriptor_t *parsed;
char desc_id[DIGEST_LEN];
char *intro_content;
@@ -1003,6 +1004,12 @@ rend_cache_store_v2_desc_as_dir(const char *desc)
log_info(LD_REND, "Successfully stored service descriptor with desc ID "
"'%s' and len %d.",
safe_str(desc_id_base32), (int)encoded_size);
+
+ /* Statistics: Note down this potentially new HS. */
+ if (options->HiddenServiceStatistics) {
+ rep_hist_stored_maybe_new_hs(e->parsed->pk);
+ }
+
number_stored++;
goto advance;
skip: