commit af0837d52bed57c4fdd383c23f4a0773738bb37c Author: Damian Johnson atagar@torproject.org Date: Mon Sep 23 12:06:38 2013 -0700
Letting stem check available resolvers for us
Now that stem checks that resolvers are in our PATH no need for us to do the same. --- arm/util/connections.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/arm/util/connections.py b/arm/util/connections.py index d43a85d..2eb7095 100644 --- a/arm/util/connections.py +++ b/arm/util/connections.py @@ -17,12 +17,11 @@ options that perform even better (thanks to Fabian Keil and Hans Schnehl): - procstat procstat -f <pid> | grep TCP | grep -v 0.0.0.0:0 """
-import re import os import time import threading
-from stem.util import conf, connection, enum, log, proc, system +from stem.util import conf, connection, log, system
# If true this provides new instantiations for resolvers if the old one has # been stopped. This can make it difficult ensure all threads are terminated @@ -189,23 +188,14 @@ class ConnectionResolver(threading.Thread): self.defaultRate = CONFIG["queries.connections.minRate"] self.lastLookup = -1 self.overwriteResolver = None - self.defaultResolver = connection.Resolver.PROC
+ self.defaultResolver = None self.resolverOptions = connection.get_system_resolvers()
- osType = os.uname()[0] - log.info("Operating System: %s, Connection Resolvers: %s" % (osType, ", ".join(self.resolverOptions))) + log.info("Operating System: %s, Connection Resolvers: %s" % (os.uname()[0], ", ".join(self.resolverOptions)))
- # sets the default resolver to be the first found in the system's PATH - # (left as netstat if none are found) - for resolver in self.resolverOptions: - # Resolver strings correspond to their command with the exception of bsd - # resolvers. - resolverCmd = resolver.replace(" (bsd)", "") - - if resolver == connection.Resolver.PROC or system.is_available(resolverCmd): - self.defaultResolver = resolver - break + if self.resolverOptions: + self.defaultResolver = self.resolverOptions[0]
self._connections = [] # connection cache (latest results) self._resolutionCounter = 0 # number of successful connection resolutions
tor-commits@lists.torproject.org