diff --git a/oml/tor.py b/oml/tor.py index c669233..d9f84d9 100644 --- a/oml/tor.py +++ b/oml/tor.py @@ -17,6 +17,8 @@ logging.getLogger('stem').setLevel(logging.ERROR) logger = logging.getLogger(__name__) class TorDaemon(Thread): + installing = False + def __init__(self): self._status = [] Thread.__init__(self) @@ -50,7 +52,9 @@ DirReqStatistics 0 tor = get_tor() if not tor: self._status.append('No tor binary found. Please install TorBrowser or tor') + self.installing = True install_tor() + self.installing = False tor = get_tor() if tor: cmd = [tor, '--defaults-torrc', defaults, '-f', torrc] @@ -92,11 +96,11 @@ class Tor(object): pass if not connected: if not self.daemon: - logger.debug("start own tor process") + logger.debug("Start tor") self.daemon = TorDaemon() - logger.debug("daemon %s", self.daemon) return self.connect() - logger.debug("Failed to connect to system or own tor process.") + if not self.daemon.installing: + logger.debug("Failed to connect to tor") return False try: self.controller.authenticate()