dont print warning while tor is installed

This commit is contained in:
j 2016-01-17 12:34:43 +05:30
parent 021c418622
commit 6b25845660
1 changed files with 7 additions and 3 deletions

View File

@ -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()