commit 758f632de2acc90bd0d7d1f1022624b723b288ae Author: Damian Johnson atagar@torproject.org Date: Sun Mar 6 17:13:15 2016 -0800
Don't use fallback directories when fetching descriptors
Bah. Added fallback directories into our default pool to lessen load on dirauths, but they can't serve extrainfo descriptors...
https://trac.torproject.org/projects/tor/ticket/18489
This is usually fine for tor clients, but not for us. --- docs/change_log.rst | 1 - stem/descriptor/remote.py | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/docs/change_log.rst b/docs/change_log.rst index 3ce6df2..26e9966 100644 --- a/docs/change_log.rst +++ b/docs/change_log.rst @@ -61,7 +61,6 @@ The following are only available within Stem's `git repository
* `Shorthand functions for stem.descriptor.remote <api/descriptor/remote.html#stem.descriptor.remote.get_instance>`_ * Added `fallback directory information <api/descriptor/remote.html#stem.descriptor.remote.FallbackDirectory>`_. - * Lessened dirauth load of `stem.descriptor.remote <api/descriptor/remote.html>`_ by using fallback directories as well * Support for ed25519 descriptor fields (:spec:`5a79d67`) * Server descriptor validation fails with 'extra-info-digest line had an invalid value' from additions in proposal 228 (:trac:`16227`) * :class:`~stem.descriptor.server_descriptor.BridgeDescriptor` now has 'ntor_onion_key' like its unsanitized counterparts diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py index 2374071..09aba84 100644 --- a/stem/descriptor/remote.py +++ b/stem/descriptor/remote.py @@ -429,16 +429,11 @@ class Query(object): :returns: **str** for the url being queried by this request """
- if use_authority: + if use_authority or not self.endpoints: directories = get_authorities().values()
picked = random.choice(directories) address, dirport = picked.address, picked.dir_port - elif not self.endpoints: - directories = get_authorities().values() + FallbackDirectory.from_cache().values() - - picked = random.choice(directories) - address, dirport = picked.address, picked.dir_port else: address, dirport = random.choice(self.endpoints)
@@ -487,7 +482,7 @@ class DescriptorDownloader(object): def __init__(self, use_mirrors = False, **default_args): self._default_args = default_args
- directories = list(get_authorities().values()) + list(FallbackDirectory.from_cache().values()) + directories = list(get_authorities().values()) self._endpoints = [(directory.address, directory.dir_port) for directory in directories]
if use_mirrors: @@ -509,7 +504,7 @@ class DescriptorDownloader(object): :raises: **Exception** if unable to determine the directory mirrors """
- directories = get_authorities().values() + FallbackDirectory.from_cache().values() + directories = get_authorities().values() new_endpoints = set([(directory.address, directory.dir_port) for directory in directories])
consensus = list(self.get_consensus(document_handler = stem.descriptor.DocumentHandler.DOCUMENT).run())[0]
tor-commits@lists.torproject.org