aboutsummaryrefslogtreecommitdiff
path: root/src/or/command.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/command.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/command.c')
-rw-r--r--src/or/command.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 268c495371..8e214bf0a4 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -438,6 +438,7 @@ command_process_created_cell(cell_t *cell, channel_t *chan)
static void
command_process_relay_cell(cell_t *cell, channel_t *chan)
{
+ const or_options_t *options = get_options();
circuit_t *circ;
int reason, direction;
@@ -511,6 +512,14 @@ command_process_relay_cell(cell_t *cell, channel_t *chan)
direction==CELL_DIRECTION_OUT?"forward":"backward");
circuit_mark_for_close(circ, -reason);
}
+
+ /* If this is a cell in an RP circuit, count it as part of the
+ hidden service stats */
+ if (options->HiddenServiceStatistics &&
+ !CIRCUIT_IS_ORIGIN(circ) &&
+ TO_OR_CIRCUIT(circ)->circuit_carries_hs_traffic_stats) {
+ rep_hist_seen_new_rp_cell();
+ }
}
/** Process a 'destroy' <b>cell</b> that just arrived from