From 1e8e8a4e943c171420ae3e90cbd37227780823ed Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Tue, 28 Mar 2017 17:34:54 -0400 Subject: Add tests for new_route_len() --- src/or/circuitbuild.c | 7 +++---- src/or/circuitbuild.h | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/or') diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f08e2ee6af..5277e10a2c 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -73,7 +73,6 @@ static int circuit_deliver_create_cell(circuit_t *circ, static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit); static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath); static int onion_extend_cpath(origin_circuit_t *circ); -static int count_acceptable_nodes(smartlist_t *routers); static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice); /** This function tries to get a channel to the specified endpoint, @@ -1552,7 +1551,7 @@ onionskin_answer(or_circuit_t *circ, * If the routerlist nodes doesn't have enough routers * to handle the desired path length, return -1. */ -static int +STATIC int new_route_len(uint8_t purpose, extend_info_t *exit_ei, smartlist_t *nodes) { int num_acceptable_routers; @@ -2188,8 +2187,8 @@ circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *exit_ei) /** Return the number of routers in routers that are currently up * and available for building circuits through. */ -static int -count_acceptable_nodes(smartlist_t *nodes) +MOCK_IMPL(STATIC int, +count_acceptable_nodes, (smartlist_t *nodes)) { int num=0; diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 62a80b2b89..45d9b2fb75 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -77,6 +77,9 @@ void circuit_upgrade_circuits_from_guard_wait(void); #ifdef CIRCUITBUILD_PRIVATE STATIC circid_t get_unique_circ_id_by_chan(channel_t *chan); +STATIC int new_route_len(uint8_t purpose, extend_info_t *exit_ei, + smartlist_t *nodes); +MOCK_DECL(STATIC int, count_acceptable_nodes, (smartlist_t *nodes)); #if defined(ENABLE_TOR2WEB_MODE) || defined(TOR_UNIT_TESTS) STATIC const node_t *pick_tor2web_rendezvous_node(router_crn_flags_t flags, const or_options_t *options); -- cgit v1.2.3-54-g00ecf