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

View file

@ -17,6 +17,8 @@ logging.getLogger('stem').setLevel(logging.ERROR)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class TorDaemon(Thread): class TorDaemon(Thread):
installing = False
def __init__(self): def __init__(self):
self._status = [] self._status = []
Thread.__init__(self) Thread.__init__(self)
@ -50,7 +52,9 @@ DirReqStatistics 0
tor = get_tor() tor = get_tor()
if not tor: if not tor:
self._status.append('No tor binary found. Please install TorBrowser or tor') self._status.append('No tor binary found. Please install TorBrowser or tor')
self.installing = True
install_tor() install_tor()
self.installing = False
tor = get_tor() tor = get_tor()
if tor: if tor:
cmd = [tor, '--defaults-torrc', defaults, '-f', torrc] cmd = [tor, '--defaults-torrc', defaults, '-f', torrc]
@ -92,11 +96,11 @@ class Tor(object):
pass pass
if not connected: if not connected:
if not self.daemon: if not self.daemon:
logger.debug("start own tor process") logger.debug("Start tor")
self.daemon = TorDaemon() self.daemon = TorDaemon()
logger.debug("daemon %s", self.daemon)
return self.connect() 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 return False
try: try:
self.controller.authenticate() self.controller.authenticate()