From fea3382aca569cd93cc0a43b45e558e58cee6b8e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 17 Dec 2008 13:14:40 +0000 Subject: [PATCH] Backport r17091: when we have no pending streams, choose exits with choose_good_exit_server_general rather than with circuit_get_unhandled_ports(). svn:r17637 --- ChangeLog | 3 +++ doc/TODO.020 | 6 ++++-- src/or/circuitbuild.c | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d4574492f..37c68561db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,9 @@ Changes in version 0.2.0.33 - 200?-??-?? until one succeeds. Fixes bug 691. - Use 64 bits instead of 32 bits for connection identifiers used with the controller protocol, to greatly reduce risk of identifier reuse. + - When we're choosing an exit node for a circuit, and we have no pending + streams, choose a good general exit rather than one that supports "all + the pending streams". Bugfix on 0.1.1.x. (Fix by rovv.) o Minor features: - Report the case where all signatures in a detached set are rejected diff --git a/doc/TODO.020 b/doc/TODO.020 index bc0855f22f..2d4d3b2298 100644 --- a/doc/TODO.020 +++ b/doc/TODO.020 @@ -12,8 +12,10 @@ Backport for 0.2.0 once better tested: approach). (Also maybe r16674) [Partially backported. Instead of the basic name checking, I backported r17171 instead, to be even more resistant to poisoning.] - - r17091: distinguish "no routers support pending circuits" from - "no circuits are pending." See also r17181 and r17184. + o r17091: distinguish "no routers support pending circuits" from + "no circuits are pending." + - See also r17181... + - ... and r17184. - r17137: send END cell in response to connect to nonexistent hidserv port. - r17138: reject *:* servers should never do DNS lookups. - r17139: Fix another case of overriding .exit choices. diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 606eab908f..473b67875a 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1255,6 +1255,11 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime, // router->nickname, i); } }); /* End looping over connections. */ + if (n_pending_connections > 0 && n_supported[i] == 0) { + /* Leave best_support at -1 if that's where it is, so we can + * distinguish it later. */ + continue; + } if (n_supported[i] > best_support) { /* If this router is better than previous ones, remember its index * and goodness, and start counting how many routers are this good. */