diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-01-18 15:27:10 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-01-18 15:27:10 -0500 |
commit | 472b277207219d791a399d4d449af6ffdf00a081 (patch) | |
tree | 5a174ebfac759081c1c6c2adf614c43cc75325c3 /src/test/test_routerlist.c | |
parent | e167a0e17d9211205651b07b65b0e83695bf6cf1 (diff) | |
download | tor-472b277207219d791a399d4d449af6ffdf00a081.tar.gz tor-472b277207219d791a399d4d449af6ffdf00a081.zip |
Remove the (no longer compiled) code for legacy guard selection.
Part of 20830.
Diffstat (limited to 'src/test/test_routerlist.c')
-rw-r--r-- | src/test/test_routerlist.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c index 73e8d1047c..78f1cf16b7 100644 --- a/src/test/test_routerlist.c +++ b/src/test/test_routerlist.c @@ -204,55 +204,6 @@ mock_usable_consensus_flavor(void) return mock_usable_consensus_flavor_value; } -#ifdef ENABLE_LEGACY_GUARD_ALGORITHM -static smartlist_t *mock_is_guard_list = NULL; - -static int -mock_is_node_used_as_guard(const node_t *n) -{ - if (mock_is_guard_list) { - SMARTLIST_FOREACH_BEGIN(mock_is_guard_list, node_t *, e) { - if (e == n) return 1; - } SMARTLIST_FOREACH_END(e); - } - - return 0; -} - -static void -mark_node_used_as_guard(node_t *n) -{ - if (!n) return; - - if (!mock_is_guard_list) { - mock_is_guard_list = smartlist_new(); - } - - if (!mock_is_node_used_as_guard(n)) { - smartlist_add(mock_is_guard_list, n); - } -} - -static void -mark_node_unused_as_guard(node_t *n) -{ - if (!n) return; - - if (!mock_is_guard_list) return; - - smartlist_remove(mock_is_guard_list, n); -} - -static void -clear_mock_guard_list(void) -{ - if (mock_is_guard_list) { - smartlist_free(mock_is_guard_list); - mock_is_guard_list = NULL; - } -} -#endif - static void test_router_pick_directory_server_impl(void *arg) { @@ -273,9 +224,6 @@ test_router_pick_directory_server_impl(void *arg) (void)arg; MOCK(usable_consensus_flavor, mock_usable_consensus_flavor); -#ifdef ENABLE_LEGACY_GUARD_ALGORITHM - MOCK(is_node_used_as_guard, mock_is_node_used_as_guard); -#endif /* With no consensus, we must be bootstrapping, regardless of time or flavor */ @@ -388,34 +336,6 @@ test_router_pick_directory_server_impl(void *arg) node_router1->is_valid = 1; node_router3->is_valid = 1; -#ifdef ENABLE_LEGACY_GUARD_ALGORITHM - flags |= PDS_FOR_GUARD; - mark_node_used_as_guard(node_router1); - mark_node_used_as_guard(node_router2); - mark_node_used_as_guard(node_router3); - rs = router_pick_directory_server_impl(V3_DIRINFO, flags, NULL); - tt_assert(rs == NULL); - mark_node_unused_as_guard(node_router1); - rs = router_pick_directory_server_impl(V3_DIRINFO, flags, NULL); - tt_assert(rs != NULL); - tt_assert(tor_memeq(rs->identity_digest, router1_id, DIGEST_LEN)); - rs = NULL; - mark_node_unused_as_guard(node_router2); - mark_node_unused_as_guard(node_router3); -#endif - - /* One not valid, one guard. This should leave one remaining */ -#ifdef ENABLE_LEGACY_GUARD_ALGORITHM - node_router1->is_valid = 0; - mark_node_used_as_guard(node_router2); - rs = router_pick_directory_server_impl(V3_DIRINFO, flags, NULL); - tt_assert(rs != NULL); - tt_assert(tor_memeq(rs->identity_digest, router3_id, DIGEST_LEN)); - rs = NULL; - node_router1->is_valid = 1; - mark_node_unused_as_guard(node_router2); -#endif - /* Manipulate overloaded */ node_router2->rs->last_dir_503_at = now; @@ -477,10 +397,6 @@ test_router_pick_directory_server_impl(void *arg) done: UNMOCK(usable_consensus_flavor); -#ifdef ENABLE_LEGACY_GUARD_ALGORITHM - UNMOCK(is_node_used_as_guard); - clear_mock_guard_list(); -#endif if (router1_id) tor_free(router1_id); |