summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-12-15 09:53:00 +0000
committerRoger Dingledine <arma@torproject.org>2005-12-15 09:53:00 +0000
commit25e1ad02faa1a6392d07a0d745eae8bb04003ee6 (patch)
treedb618e3d32eca8a8c2a59f77554b0d528192471c /src
parente15c098eb876a796673c87a1cc17ec57ef7aee55 (diff)
downloadtor-25e1ad02faa1a6392d07a0d745eae8bb04003ee6.tar.gz
tor-25e1ad02faa1a6392d07a0d745eae8bb04003ee6.zip
implement weasel's suggestion to fix the bug that newly bootstrapped
tor networks couldn't do hidden services until they had nodes with high uptime: if you're trying to pick a node for your circuit and you demand uptime or capacity and nothing works, then abandon your need for uptime and capacity. svn:r5589
Diffstat (limited to 'src')
-rw-r--r--src/or/routerlist.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 44033a15c4..408a712350 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -794,8 +794,8 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl)
* <b>excludedsmartlist</b>, even if they are the only nodes
* available. If <b>strict</b> is true, never pick any node besides
* those in <b>preferred</b>.
- * If <b>need_uptime</b> is non-zero, don't return a router with less
- * than a minimum uptime.
+ * If <b>need_uptime</b> is non-zero and any router has more than
+ * a minimum uptime, return one of those.
* If <b>need_capacity</b> is non-zero, weight your choice by the
* advertised capacity of each router.
*/
@@ -837,6 +837,15 @@ router_choose_random_node(const char *preferred,
else
choice = smartlist_choose(sl);
smartlist_free(sl);
+ if (!choice && (need_uptime || need_capacity)) {
+ /* try once more -- recurse but with fewer restrictions. */
+ info(LD_CIRC, "We couldn't find any live%s%s routers; falling back "
+ "to list of all routers.",
+ need_capacity?", fast":"",
+ need_uptime?", stable":"");
+ choice = router_choose_random_node(
+ NULL, excluded, excludedsmartlist, 0, 0, allow_unverified, 0);
+ }
}
smartlist_free(excludednodes);
if (!choice)