]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Call exit_policy_is_general_exit less
authorSebastian Hahn <sebastian@torproject.org>
Wed, 3 Feb 2010 22:54:18 +0000 (23:54 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Wed, 3 Feb 2010 23:06:56 +0000 (00:06 +0100)
When calculating the is_exit flag for a routerinfo_t, we don't need
to call exit_policy_is_general_exit() if router_exit_policy_rejects_all()
tells us it definitely is an exit. This check is much cheaper than
running exit_policy_is_general_exit().

src/or/dirserv.c

index 30246123579c885cf020a31b94b0eacb0cd25f6a..8009647c91f036892f70c9a19770c158f0338865 100644 (file)
@@ -1776,7 +1776,8 @@ dirserv_compute_performance_thresholds(routerlist_t *rl)
     if (router_is_active(ri, now)) {
       const char *id = ri->cache_info.identity_digest;
       uint32_t bw;
-      ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
+      ri->is_exit = (!router_exit_policy_rejects_all(ri) &&
+                    exit_policy_is_general_exit(ri->exit_policy));
       uptimes[n_active] = (uint32_t)real_uptime(ri, now);
       mtbfs[n_active] = rep_hist_get_stability(id, now);
       tks  [n_active] = rep_hist_get_weighted_time_known(id, now);