diff options
author | Roger Dingledine <arma@torproject.org> | 2007-06-15 02:12:15 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-06-15 02:12:15 +0000 |
commit | 3d641bde0e6d86f924252ae0f7cd427212ef937e (patch) | |
tree | 67aed855134ca951ad8661d83069d920a39095fa /src/or/directory.c | |
parent | 4398a0991033331de7df5f07df7384e8b8550418 (diff) | |
download | tor-3d641bde0e6d86f924252ae0f7cd427212ef937e.tar.gz tor-3d641bde0e6d86f924252ae0f7cd427212ef937e.zip |
Refine r10571: more work on bridge stuff.
- Only listen to responses for "authority" fetches if we're configured
to use Bridges. Otherwise it's safe (and maybe smarter) to silently
discard them like we used to.
- React faster to download networkstatuses after the first bridge
descriptor arrives.
- Don't do dir fetches before we have any bridges, even when our
dirport is open.
svn:r10604
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 8c483f5cae..83a7a7b0b2 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1269,14 +1269,17 @@ connection_dir_client_reached_eof(dir_connection_t *conn) return dir_okay ? 0 : -1; } /* Learn the routers, assuming we requested by fingerprint or "all" - * or "authority". (We use "authority" to fetch our own descriptor for - * testing, and to fetch bridge descriptors for bootstrapping.) - */ - /* XXX020 We now risk replacing ourself with a router running at - * the addr:port we think we have. Might want to check more carefully. */ + * or "authority". + * + * We use "authority" to fetch our own descriptor for + * testing, and to fetch bridge descriptors for bootstrapping. Ignore + * the output of "authority" requests unless we are using bridges, + * since otherwise they'll be the response from reachability tests, + * and we don't really want to add that to our routerlist. */ if (which || (conn->requested_resource && (!strcmpstart(conn->requested_resource, "all") || - !strcmpstart(conn->requested_resource, "authority")))) { + (!strcmpstart(conn->requested_resource, "authority") && + get_options()->UseBridges)))) { /* as we learn from them, we remove them from 'which' */ if (was_ei) { router_load_extrainfo_from_string(body, NULL, SAVED_NOWHERE, which); @@ -1694,7 +1697,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, "don't have a good one yet. Sending 503 Dir not available."); write_http_status_line(conn, 503, "Directory unavailable"); /* try to get a new one now */ - if (!already_fetching_directory(DIR_PURPOSE_FETCH_DIR)) + if (!already_fetching_directory(DIR_PURPOSE_FETCH_DIR) && + !should_delay_dir_fetches(options)) directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1); tor_free(url); return 0; @@ -1744,7 +1748,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, if (!d) { write_http_status_line(conn, 503, "Directory unavailable"); /* try to get a new one now */ - if (!already_fetching_directory(DIR_PURPOSE_FETCH_RUNNING_LIST)) + if (!already_fetching_directory(DIR_PURPOSE_FETCH_RUNNING_LIST) && + !should_delay_dir_fetches(options)) directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST, NULL, 1); tor_free(url); return 0; |