aboutsummaryrefslogtreecommitdiff
path: root/src/feature/stats
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-07-01 12:26:19 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-01 12:26:19 -0400
commitf30f53e0992e78127602a15c27efd10060e45930 (patch)
treef4041e7d0695b2e71231a8e35a44362800367ef6 /src/feature/stats
parent368156fcb79c8c1eb2791b71f47aad5b2f7f0377 (diff)
parentb558971c070e481546f4f6b9d101db86e111f2d4 (diff)
downloadtor-f30f53e0992e78127602a15c27efd10060e45930.tar.gz
tor-f30f53e0992e78127602a15c27efd10060e45930.zip
Merge branch 'tor-github/pr/1907'
Diffstat (limited to 'src/feature/stats')
-rw-r--r--src/feature/stats/rephist.c20
-rw-r--r--src/feature/stats/rephist.h3
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);