Proxy error handling
- UI will now display notifications in the status bar if the connection to the proxy itself is broken. This should give better feedback to people who are unfamiliar with tor and misconfigured it - The proxy error handling in the background was slightly improved as well
This commit is contained in:
parent
7aecb4aad1
commit
ab79ee2a04
|
@ -203,7 +203,16 @@ class outgoingSynSender(threading.Thread, StoppableThread):
|
||||||
|
|
||||||
logger.debug(str(self) + ' connected to ' + str(peer) + ' during an outgoing attempt.')
|
logger.debug(str(self) + ' connected to ' + str(peer) + ' during an outgoing attempt.')
|
||||||
except socks.GeneralProxyError as err:
|
except socks.GeneralProxyError as err:
|
||||||
if shared.verbose >= 2:
|
if err[0][0] in [7, 8, 9]:
|
||||||
|
logger.error('Error communicating with proxy: %s', str(err))
|
||||||
|
shared.UISignalQueue.put((
|
||||||
|
'updateStatusBar',
|
||||||
|
tr._translate(
|
||||||
|
"MainWindow", "Problem communicating with proxy: %1. Please check your network settings.").arg(str(err[0][1]))
|
||||||
|
))
|
||||||
|
self.stop.wait(1)
|
||||||
|
continue
|
||||||
|
elif shared.verbose >= 2:
|
||||||
logger.debug('Could NOT connect to ' + str(peer) + ' during outgoing attempt. ' + str(err))
|
logger.debug('Could NOT connect to ' + str(peer) + ' during outgoing attempt. ' + str(err))
|
||||||
|
|
||||||
deletedPeer = None
|
deletedPeer = None
|
||||||
|
@ -227,13 +236,13 @@ class outgoingSynSender(threading.Thread, StoppableThread):
|
||||||
except socks.Socks5AuthError as err:
|
except socks.Socks5AuthError as err:
|
||||||
shared.UISignalQueue.put((
|
shared.UISignalQueue.put((
|
||||||
'updateStatusBar', tr._translate(
|
'updateStatusBar', tr._translate(
|
||||||
"MainWindow", "SOCKS5 Authentication problem: %1").arg(str(err))))
|
"MainWindow", "SOCKS5 Authentication problem: %1. Please check your SOCKS5 settings").arg(str(err))))
|
||||||
except socks.Socks5Error as err:
|
except socks.Socks5Error as err:
|
||||||
if err[0] in [3, 4, 5, 6]:
|
if err[0][0] in [3, 4, 5, 6]:
|
||||||
# this is a more bening "error": host unreachable, network unreachable, connection refused, TTL expired
|
# this is a more bening "error": host unreachable, network unreachable, connection refused, TTL expired
|
||||||
logger.debug('SOCKS5 error. ' + str(err))
|
logger.debug('SOCKS5 error: %s', str(err))
|
||||||
else:
|
else:
|
||||||
logger.error('SOCKS5 error. ' + str(err))
|
logger.error('SOCKS5 error: %s', str(err))
|
||||||
except socks.Socks4Error as err:
|
except socks.Socks4Error as err:
|
||||||
logger.error('Socks4Error: ' + str(err))
|
logger.error('Socks4Error: ' + str(err))
|
||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
|
|
|
@ -85,6 +85,7 @@ def dns():
|
||||||
sock.close()
|
sock.close()
|
||||||
except:
|
except:
|
||||||
logger.error("SOCKS DNS resolving failed", exc_info=True)
|
logger.error("SOCKS DNS resolving failed", exc_info=True)
|
||||||
|
else:
|
||||||
if ip is not None:
|
if ip is not None:
|
||||||
logger.info ('Adding ' + ip + ' to knownNodes based on SOCKS DNS bootstrap method')
|
logger.info ('Adding ' + ip + ' to knownNodes based on SOCKS DNS bootstrap method')
|
||||||
shared.knownNodes[1][shared.Peer(ip, port)] = time.time()
|
shared.knownNodes[1][shared.Peer(ip, port)] = time.time()
|
||||||
|
|
|
@ -64,7 +64,10 @@ _generalerrors = ("success",
|
||||||
"not available",
|
"not available",
|
||||||
"bad proxy type",
|
"bad proxy type",
|
||||||
"bad input",
|
"bad input",
|
||||||
"timed out")
|
"timed out",
|
||||||
|
"network unreachable",
|
||||||
|
"connection refused",
|
||||||
|
"host unreachable")
|
||||||
|
|
||||||
_socks5errors = ("succeeded",
|
_socks5errors = ("succeeded",
|
||||||
"general SOCKS server failure",
|
"general SOCKS server failure",
|
||||||
|
@ -404,9 +407,11 @@ class socksocket(socket.socket):
|
||||||
_orgsocket.connect(self, (self.__proxy[1], portnum))
|
_orgsocket.connect(self, (self.__proxy[1], portnum))
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e[0] == 101:
|
if e[0] == 101:
|
||||||
raise Socks5Error((3, _socks5errors[3]))
|
raise GeneralProxyError((7, _generalerrors[7]))
|
||||||
if e[0] == 111:
|
if e[0] == 111:
|
||||||
raise Socks5Error((5, _socks5errors[5]))
|
raise GeneralProxyError((8, _generalerrors[8]))
|
||||||
|
if e[0] == 113:
|
||||||
|
raise GeneralProxyError((9, _generalerrors[9]))
|
||||||
raise
|
raise
|
||||||
self.__negotiatesocks5()
|
self.__negotiatesocks5()
|
||||||
self.__connectsocks5(destpair[0], destpair[1])
|
self.__connectsocks5(destpair[0], destpair[1])
|
||||||
|
|
Reference in New Issue
Block a user