summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2017-09-20 20:24:59 +0000
committerMike Perry <mikeperry-git@torproject.org>2017-12-07 00:04:39 +0000
commit050bb67974c11e0f390f4b1fa1b067c86538c59e (patch)
tree7ecf0e8ceaca199177e203c8d35936ae41279899 /src/or
parent125df07d609933a7974f362706b126a4bf339788 (diff)
downloadtor-050bb67974c11e0f390f4b1fa1b067c86538c59e.tar.gz
tor-050bb67974c11e0f390f4b1fa1b067c86538c59e.zip
Add tests for circuitstats.c
These tests primarily test the relaxed and measured behavior of circuitstats.c, to make sure we did not break it with #23100 or #23114.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c4
-rw-r--r--src/or/circuituse.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0be54c533c..b56190fee2 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -75,7 +75,7 @@ static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit,
int is_hs_v3_rp_circuit);
static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath);
static int onion_extend_cpath(origin_circuit_t *circ);
-static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
+STATIC int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
static int circuit_send_first_onion_skin(origin_circuit_t *circ);
static int circuit_build_no_more_hops(origin_circuit_t *circ);
static int circuit_send_intermediate_onion_skin(origin_circuit_t *circ,
@@ -2586,7 +2586,7 @@ onion_extend_cpath(origin_circuit_t *circ)
/** Create a new hop, annotate it with information about its
* corresponding router <b>choice</b>, and append it to the
* end of the cpath <b>head_ptr</b>. */
-static int
+STATIC int
onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice)
{
crypt_path_t *hop = tor_malloc_zero(sizeof(crypt_path_t));
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 1335e12c6a..d4657921ea 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -585,7 +585,8 @@ circuit_expire_building(void)
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
-1,
circuit_state_to_string(victim->state),
- channel_state_to_string(victim->n_chan->state));
+ victim->n_chan ?
+ channel_state_to_string(victim->n_chan->state) : "none");
/* We count the timeout here for CBT, because technically this
* was a timeout, and the timeout value needs to reset if we
@@ -610,7 +611,8 @@ circuit_expire_building(void)
TO_ORIGIN_CIRCUIT(victim)->build_state->desired_path_len :
-1,
circuit_state_to_string(victim->state),
- channel_state_to_string(victim->n_chan->state),
+ victim->n_chan ?
+ channel_state_to_string(victim->n_chan->state) : "none",
(long)build_close_ms);
}
}