set proxy as invalid if hostname cannot be

resolved
This commit is contained in:
Dimitur Kirov 2006-09-14 08:40:09 +00:00
parent 08506dedf7
commit 5764374e5d
2 changed files with 7 additions and 1 deletions

View File

@ -186,6 +186,9 @@ class HostTester(Socks5, IdleObject):
def connect(self):
''' create the socket and plug it to the idlequeue '''
if self.host is None:
self.on_failure()
return None
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._sock.setblocking(False)
self.fd = self._sock.fileno()

View File

@ -350,7 +350,10 @@ class SocksQueue:
class Socks5:
def __init__(self, idlequeue, host, port, initiator, target, sid):
if host is not None:
self.host = socket.gethostbyname(host)
try:
self.host = socket.gethostbyname(host)
except socket.gaierror:
self.host = None
self.idlequeue = idlequeue
self.fd = -1
self.port = port