aboutsummaryrefslogtreecommitdiff
path: root/src/feature/stats/rephist.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-10-21 13:50:32 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2020-11-03 11:09:34 +0200
commit3cbc513ae767aa872f690ab23f94535aa121975d (patch)
tree6071ecfc0fcbefcc12d09c53faa83b23d214d46f /src/feature/stats/rephist.c
parent05880d238a95b09c08b600e546870d0870f856fd (diff)
downloadtor-3cbc513ae767aa872f690ab23f94535aa121975d.tar.gz
tor-3cbc513ae767aa872f690ab23f94535aa121975d.zip
Implement support for "v3 rend traffic" stat.
Diffstat (limited to 'src/feature/stats/rephist.c')
-rw-r--r--src/feature/stats/rephist.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index 5858f14245..2ad86ff6d9 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -1932,6 +1932,20 @@ rep_hist_hsdir_stored_maybe_new_v3_onion(const uint8_t *blinded_key)
}
}
+/** We saw a new HS relay cell: count it!
+ * If <b>is_v2</b> is set then it's a v2 RP cell, otherwise it's a v3. */
+void
+rep_hist_seen_new_rp_cell(bool is_v2)
+{
+ log_debug(LD_GENERAL, "New RP cell (%d)", is_v2);
+
+ if (is_v2 && hs_v2_stats) {
+ hs_v2_stats->rp_v2_relay_cells_seen++;
+ } else if (!is_v2 && hs_v3_stats && should_collect_v3_stats()) {
+ hs_v3_stats->rp_v3_relay_cells_seen++;
+ }
+}
+
/* The number of cells that are supposed to be hidden from the adversary
* by adding noise from the Laplace distribution. This value, divided by
* EPSILON, is Laplace parameter b. It must be greather than 0. */