[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Use dirauth for last request



commit 3e0c2f4262d34939046d2f88af1dd0993cf2ef8d
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Mar 6 16:36:46 2016 -0800

    Use dirauth for last request
    
    When request descriptors we default to using a directory authority for our last
    attempt if earlier tries failed. Mistakenly we were including fallback
    directories in this final selection.
---
 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 baba8ac..2374071 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -429,7 +429,12 @@ class Query(object):
     :returns: **str** for the url being queried by this request
     """
 
-    if use_authority or not self.endpoints:
+    if use_authority:
+      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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits