diff options
author | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2016-05-04 15:41:37 +1000 |
---|---|---|
committer | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2016-05-10 11:25:55 -0400 |
commit | 92d7ee08b8c51b4b29f68c6d00ca4aa91ea5a66b (patch) | |
tree | 0cd47d9d7d9cb6390f06223e9c61ddd0c39ddd59 /src/or/routerlist.c | |
parent | 64b948f5fa0099ddabcf0c63e437cc8e7373ef38 (diff) | |
download | tor-92d7ee08b8c51b4b29f68c6d00ca4aa91ea5a66b.tar.gz tor-92d7ee08b8c51b4b29f68c6d00ca4aa91ea5a66b.zip |
Switch between fallback and authority when auth cert fetch fails
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 85e9e7d834..31693437e1 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -912,11 +912,14 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now) } SMARTLIST_FOREACH_END(d); if (smartlist_len(fps) > 1) { + static int want_auth = 0; resource = smartlist_join_strings(fps, "", 0, NULL); - /* XXX - do we want certs from authorities or mirrors? - teor */ directory_get_from_dirserver(DIR_PURPOSE_FETCH_CERTIFICATE, 0, resource, PDS_RETRY_IF_NO_SERVERS, - DL_WANT_ANY_DIRSERVER); + want_auth ? DL_WANT_AUTHORITY + : DL_WANT_ANY_DIRSERVER); + /* on failure, swap between using fallbacks and authorities */ + want_auth = !want_auth; tor_free(resource); } /* else we didn't add any: they were all pending */ @@ -958,11 +961,14 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now) } SMARTLIST_FOREACH_END(d); if (smartlist_len(fp_pairs) > 1) { + static int want_auth = 0; resource = smartlist_join_strings(fp_pairs, "", 0, NULL); - /* XXX - do we want certs from authorities or mirrors? - teor */ directory_get_from_dirserver(DIR_PURPOSE_FETCH_CERTIFICATE, 0, resource, PDS_RETRY_IF_NO_SERVERS, - DL_WANT_ANY_DIRSERVER); + want_auth ? DL_WANT_AUTHORITY + : DL_WANT_ANY_DIRSERVER); + /* on failure, swap between using fallbacks and authorities */ + want_auth = !want_auth; tor_free(resource); } /* else they were all pending */ |