summaryrefslogtreecommitdiff
path: root/src/test/test_entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-26 11:03:22 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-26 11:04:44 -0400
commit650b94ebc157da01fcb34e08341ad1717c61f4fe (patch)
tree893a8598f587f986ed969b63a6f6009abd5b43b2 /src/test/test_entrynodes.c
parent1d44ac9acd6264141615b5fce6d537544dc6f52e (diff)
downloadtor-650b94ebc157da01fcb34e08341ad1717c61f4fe.tar.gz
tor-650b94ebc157da01fcb34e08341ad1717c61f4fe.zip
Use a linear algorithm to subtract two nodelists.
The nodelist_idx for each node_t serves as a unique identifier for the node, so we can use a bitarray to hold all the excluded nodes, and then remove them from the smartlist. Previously use used smartlist_subtract(sl, excluded), which is O(len(sl)*len(excluded)). We can use this function in other places too, but this is the one that showed up on the profiles of 30291. Closes ticket 30307.
Diffstat (limited to 'src/test/test_entrynodes.c')
-rw-r--r--src/test/test_entrynodes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index bdf057bb50..c43b21c673 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -197,6 +197,7 @@ big_fake_network_setup(const struct testcase_t *testcase)
n->md->exit_policy = parse_short_policy("accept 443");
}
+ n->nodelist_idx = smartlist_len(big_fake_net_nodes);
smartlist_add(big_fake_net_nodes, n);
}