diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-14 12:06:59 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-14 12:06:59 -0500 |
commit | 1070a720ad7f45fa82b77be0512056a06e535b72 (patch) | |
tree | 2ff76f12390f5f7c88b1b62080ebe73b5e58873c /src/or/routerlist.c | |
parent | 91027218e29090b18d42e1868367cc2a9e149900 (diff) | |
download | tor-1070a720ad7f45fa82b77be0512056a06e535b72.tar.gz tor-1070a720ad7f45fa82b77be0512056a06e535b72.zip |
Be more robust when excluding existing nodes as new dirguards
In addition to rejecting them post-hoc, avoid picking them in the
first place. This makes us less likely to decide that we can't add
guards at all.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 90b707bcdb..837245db3e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1153,6 +1153,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags) int requireother = ! (flags & PDS_ALLOW_SELF); int fascistfirewall = ! (flags & PDS_IGNORE_FASCISTFIREWALL); int prefer_tunnel = (flags & PDS_PREFER_TUNNELED_DIR_CONNS_); + int for_guard = (flags & PDS_FOR_GUARD); int try_excluding = 1, n_excluded = 0; if (!consensus) @@ -1192,6 +1193,8 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags) if ((type & MICRODESC_DIRINFO) && !is_trusted && !node->rs->version_supports_microdesc_cache) continue; + if (for_guard && node->using_as_guard) + continue; /* Don't make the same node a guard twice. */ if (try_excluding && routerset_contains_routerstatus(options->ExcludeNodes, status, country)) { |