give tor a bit more time

This commit is contained in:
j 2016-03-18 11:29:18 +01:00
parent ebc0f28799
commit 992dc568c2

View file

@ -383,12 +383,13 @@ def can_connect_dns(host="8.8.8.8", port=53):
import state import state
try: try:
sock = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM, 6) sock = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM, 6)
sock.settimeout(1) sock.settimeout(2)
socks_port = state.tor.socks_port if state.tor else 9150 socks_port = state.tor.socks_port if state.tor else 9150
sock.set_proxy(socks.SOCKS5, "localhost", socks_port, True) sock.set_proxy(socks.SOCKS5, "localhost", socks_port, True)
sock.connect((host, port)) sock.connect((host, port))
return True return True
except: except:
#logger.debug('failed to connect', exc_info=True)
pass pass
return False return False