summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2012-01-25 20:49:32 -0500
committerAndrea Shepard <andrea@torproject.org>2013-02-02 08:19:27 -0800
commitbce5019eff37fc741747ef76c5d0a387569f9265 (patch)
tree8a5199b366aeb30bc4d2effc622c2de30384fec0 /src/or/directory.c
parenta8297cdbd3324ac707165ae9922ecf478c4608a1 (diff)
downloadtor-bce5019eff37fc741747ef76c5d0a387569f9265.tar.gz
tor-bce5019eff37fc741747ef76c5d0a387569f9265.zip
generalize choose_random_entry()'s dirinfo parameter
Now we can specify to skip bridges that wouldn't be able to answer the type of dir fetch we're launching. It's still the responsibility of the rest of the code to prevent us from launching a given dir fetch if we have no bridges that could handle it.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index c1bbe6bd81..a1ac2ad2e6 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -472,14 +472,13 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
if (options->UseBridges && type != BRIDGE_DIRINFO) {
/* We want to ask a running bridge for which we have a descriptor.
*
- * When we ask choose_random_entry() for a bridge, we specify that
- * we're going to be using it for a dir fetch: if any of our bridges
- * can handle microdescriptor questions, we'll get one of the ones
- * that can.
+ * When we ask choose_random_entry() for a bridge, we specify what
+ * sort of dir fetch we'll be doing, so it won't return a bridge
+ * that can't answer our question.
*/
/* XXX024 Not all bridges handle conditional consensus downloading,
* so, for now, never assume the server supports that. -PP */
- const node_t *node = choose_random_entry(NULL, 1);
+ const node_t *node = choose_random_entry(NULL, type);
if (node && node->ri) {
/* every bridge has a routerinfo. */
tor_addr_t addr;