summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/directory.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 198fb6d40f..769e3d1291 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -334,6 +334,24 @@ directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
}
}
+/**DOCDOC*/
+static const routerstatus_t *
+directory_pick_generic_dirserver(dirinfo_type_t type, int pds_flags,
+ uint8_t dir_purpose)
+{
+ const routerstatus_t *rs;
+
+ /* anybody with a non-zero dirport will do */
+ rs = router_pick_directory_server(type, pds_flags);
+ if (!rs) {
+ log_info(LD_DIR, "No router found for %s; falling back to "
+ "dirserver list.", dir_conn_purpose_to_string(dir_purpose));
+ rs = router_pick_fallback_dirserver(type, pds_flags);
+ }
+
+ return rs;
+}
+
/** Start a connection to a random running directory server, using
* connection purpose <b>dir_purpose</b>, intending to fetch descriptors
* of purpose <b>router_purpose</b>, and requesting <b>resource</b>.
@@ -469,14 +487,13 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
}
}
if (!rs && type != BRIDGE_DIRINFO) {
- /* anybody with a non-zero dirport will do */
- rs = router_pick_directory_server(type, pds_flags);
+ /* */
+ rs = directory_pick_generic_dirserver(type, pds_flags,
+ dir_purpose);
if (!rs) {
- log_info(LD_DIR, "No router found for %s; falling back to "
- "dirserver list.", dir_conn_purpose_to_string(dir_purpose));
- rs = router_pick_fallback_dirserver(type, pds_flags);
- if (!rs)
- get_via_tor = 1; /* last resort: try routing it via Tor */
+ /*XXXX024 I'm pretty sure this can never do any good, since
+ * rs isn't set. */
+ get_via_tor = 1; /* last resort: try routing it via Tor */
}
}
}