diff options
author | Neel Chauhan <neel@neelc.org> | 2020-05-27 20:40:02 -0700 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-01 12:00:53 -0400 |
commit | 4477317cbec059eefb4b86b88efa16f3a5ba7e52 (patch) | |
tree | 6e2935676d6f3d4577bd6255c485e32e46af5bea /src/feature/stats | |
parent | 8d8a9d7f1d9cc779036441cfa9639f35c20e37c9 (diff) | |
download | tor-4477317cbec059eefb4b86b88efa16f3a5ba7e52.tar.gz tor-4477317cbec059eefb4b86b88efa16f3a5ba7e52.zip |
control: Add a key to GETINFO to fetch the circuit onion handshake rephist values
Diffstat (limited to 'src/feature/stats')
-rw-r--r-- | src/feature/stats/rephist.c | 20 | ||||
-rw-r--r-- | src/feature/stats/rephist.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c index 71e2e00086..d4826cd1a9 100644 --- a/src/feature/stats/rephist.c +++ b/src/feature/stats/rephist.c @@ -2455,6 +2455,26 @@ rep_hist_note_circuit_handshake_assigned(uint16_t type) onion_handshakes_assigned[type]++; } +/** Get the circuit handshake value that is requested. */ +MOCK_IMPL(int, +rep_hist_get_circuit_handshake_requested, (uint16_t type)) +{ + if (BUG(type > MAX_ONION_HANDSHAKE_TYPE)) { + return 0; + } + return onion_handshakes_requested[type]; +} + +/** Get the circuit handshake value that is assigned. */ +MOCK_IMPL(int, +rep_hist_get_circuit_handshake_assigned, (uint16_t type)) +{ + if (BUG(type > MAX_ONION_HANDSHAKE_TYPE)) { + return 0; + } + return onion_handshakes_assigned[type]; +} + /** Log our onionskin statistics since the last time we were called. */ void rep_hist_log_circuit_handshake_stats(time_t now) diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h index 92c3d2a5a5..d08b8833cc 100644 --- a/src/feature/stats/rephist.h +++ b/src/feature/stats/rephist.h @@ -77,6 +77,9 @@ void rep_hist_note_circuit_handshake_requested(uint16_t type); void rep_hist_note_circuit_handshake_assigned(uint16_t type); void rep_hist_log_circuit_handshake_stats(time_t now); +MOCK_DECL(int, rep_hist_get_circuit_handshake_requested, (uint16_t type)); +MOCK_DECL(int, rep_hist_get_circuit_handshake_assigned, (uint16_t type)); + void rep_hist_hs_stats_init(time_t now); void rep_hist_hs_stats_term(void); time_t rep_hist_hs_stats_write(time_t now); |