summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-03 20:12:41 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-03 20:12:41 +0000
commitbf2717ff3d02e1c8527d6e6c8f14349813ba0e72 (patch)
tree04adbaff4490763f3b91a27445a800287c48722b /src/or/networkstatus.c
parentc217be996d55560b6fbb2932ab498372306b2379 (diff)
downloadtor-bf2717ff3d02e1c8527d6e6c8f14349813ba0e72.tar.gz
tor-bf2717ff3d02e1c8527d6e6c8f14349813ba0e72.zip
r14678@tombo: nickm | 2007-11-03 16:12:31 -0400
Try to make hidden service directory lookup functions a bit more efficient: go for fewer O(n) operations, and look at the consensus rather than the routerinfo list. svn:r12361
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index f08cf5334e..57b4996c63 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -754,6 +754,17 @@ networkstatus_vote_find_entry(networkstatus_vote_t *ns, const char *digest)
_compare_digest_to_routerstatus_entry);
}
+/*XXXX020 make this static once functions are moved into this file. */
+/** DOCDOC */
+int
+networkstatus_vote_find_entry_idx(networkstatus_vote_t *ns,
+ const char *digest, int *found_out)
+{
+ return smartlist_bsearch_idx(ns->routerstatus_list, digest,
+ _compare_digest_to_routerstatus_entry,
+ found_out);
+}
+
/** Return a list of the v2 networkstatus documents. */
const smartlist_t *
networkstatus_get_v2_list(void)