[tor-commits] [stem/master] Drop compression from _download_descriptors() args

atagar at torproject.org atagar at torproject.org
Wed Apr 4 20:55:27 UTC 2018


commit c1da1a4af97c808b479e424b5666bb702a7b597a
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Apr 2 10:28:19 2018 -0700

    Drop compression from _download_descriptors() args
    
    Oops, stupid me. The only reason retries are an arg for this method is so we
    can deprecate while iterating. We can just reference self.compression here
    instead.
---
 stem/descriptor/remote.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index e1190fc7..97fd1e5c 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -430,7 +430,7 @@ class Query(object):
         self._downloader_thread = threading.Thread(
           name = 'Descriptor Query',
           target = self._download_descriptors,
-          args = (self.compression, self.retries,)
+          args = (self.retries,)
         )
 
         self._downloader_thread.setDaemon(True)
@@ -520,7 +520,7 @@ class Query(object):
 
     return 'http://%s:%i/%s' % (address, dirport, self.resource.lstrip('/'))
 
-  def _download_descriptors(self, compression, retries):
+  def _download_descriptors(self, retries):
     try:
       use_authority = retries == 0 and self.fall_back_to_authority
       self.download_url = self._pick_url(use_authority)
@@ -529,7 +529,7 @@ class Query(object):
       response = urllib.urlopen(
         urllib.Request(
           self.download_url,
-          headers = {'Accept-Encoding': ', '.join(compression)},
+          headers = {'Accept-Encoding': ', '.join(self.compression)},
         ),
         timeout = self.timeout,
       )
@@ -564,7 +564,7 @@ class Query(object):
 
       if retries > 0:
         log.debug("Unable to download descriptors from '%s' (%i retries remaining): %s" % (self.download_url, retries, exc))
-        return self._download_descriptors(compression, retries - 1)
+        return self._download_descriptors(retries - 1)
       else:
         log.debug("Unable to download descriptors from '%s': %s" % (self.download_url, exc))
         self.error = exc





More information about the tor-commits mailing list