give tor a bit more time

This commit is contained in:
j 2016-03-18 11:29:18 +01:00
parent ebc0f28799
commit 992dc568c2
1 changed files with 2 additions and 1 deletions

View File

@ -383,12 +383,13 @@ def can_connect_dns(host="8.8.8.8", port=53):
import state
try:
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
sock.set_proxy(socks.SOCKS5, "localhost", socks_port, True)
sock.connect((host, port))
return True
except:
#logger.debug('failed to connect', exc_info=True)
pass
return False