aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2011-04-30 13:27:47 +0200
committerSebastian Hahn <sebastian@torproject.org>2011-04-30 22:03:51 +0200
commit47a2e5a9ce4b9324931781c76f3aa11f4d9ea0a2 (patch)
tree500c943640496c4869817d8ee3603e75c6673ccc
parent751e40805556fadec616aa79150f12e3bf87c46b (diff)
downloadtor-47a2e5a9ce4b9324931781c76f3aa11f4d9ea0a2.tar
tor-47a2e5a9ce4b9324931781c76f3aa11f4d9ea0a2.tar.gz
Don't choose exit nodes without desc available
n_supported[i] has a random value prior to initialization, so a node that doesn't have routerinfo available can have a random priority. Patch contributed by wanoskarnet from #tor. Thanks!
-rw-r--r--src/or/circuitbuild.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 04d833d87..2b5638beb 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2668,8 +2668,10 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
*/
continue;
}
- if (!node_has_descriptor(node))
+ if (!node_has_descriptor(node)) {
+ n_supported[i] = -1;
continue;
+ }
if (!node->is_running || node->is_bad_exit) {
n_supported[i] = -1;
continue; /* skip routers that are known to be down or bad exits */
@@ -2786,8 +2788,6 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
/* try once to pick only from routers that satisfy a needed port,
* then if there are none, pick from any that support exiting. */
SMARTLIST_FOREACH_BEGIN(the_nodes, const node_t *, node) {
- if (!node_has_descriptor(node))
- continue;
if (n_supported[node_sl_idx] != -1 &&
(attempt || node_handles_some_port(node, needed_ports))) {
// log_fn(LOG_DEBUG,"Try %d: '%s' is a possibility.",