Socks proxy hostname resolving error handling

- if resolving fails, it wasn't handled
This commit is contained in:
Peter Šurda 2017-02-26 20:03:14 +01:00
parent 7ebe837eb0
commit 88658b074e
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -87,8 +87,12 @@ def checkSocksIP(host):
try:
if state.socksIP is None or not state.socksIP:
state.socksIP = socket.gethostbyname(BMConfigParser().get("bitmessagesettings", "sockshostname"))
# uninitialised
except NameError:
state.socksIP = socket.gethostbyname(BMConfigParser().get("bitmessagesettings", "sockshostname"))
# resolving failure
except socket.gaierror:
state.socksIP = BMConfigParser().get("bitmessagesettings", "sockshostname")
return state.socksIP == host
def isProofOfWorkSufficient(data,