[tor-commits] [stem/master] Avoid downloading from tor26

atagar at torproject.org atagar at torproject.org
Tue Apr 24 19:41:39 UTC 2018


commit b0433da3dc236070b385f69446dc0855b6085434
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Apr 24 12:28:07 2018 -0700

    Avoid downloading from tor26
    
    Occasionally our integ tests with the ONLINE target take five minutes to run.
    Reason is that sometimes we attempt to download descriptors from tor26 which
    does not vend a usable DirPort. Good thing our tests caught this -
    DescriptorDownloader users would be nailed by this too.
---
 stem/descriptor/remote.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index fda73327..7908becf 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -464,6 +464,11 @@ class Query(object):
      :class:`~stem.ORPort` instances. Usage of tuples for this
      argument is deprecated and will be removed in the future.
 
+  .. versionchanged:: 1.7.0
+     Avoid downloading from tor26. This directory authority throttles its
+     DirPort to such an extent that requests either time out or take on the
+     order of minutes.
+
   :var str resource: resource being fetched, such as '/tor/server/all'
   :var str descriptor_type: type of descriptors being fetched (for options see
     :func:`~stem.descriptor.__init__.parse_file`), this is guessed from the
@@ -667,7 +672,7 @@ class Query(object):
     """
 
     if use_authority or not self.endpoints:
-      picked = random.choice(list(get_authorities().values()))
+      picked = random.choice([auth for auth in get_authorities().values() if auth.nickname != 'tor26'])
       return stem.DirPort(picked.address, picked.dir_port)
     else:
       return random.choice(self.endpoints)





More information about the tor-commits mailing list