diff --git a/proxywatchd.py b/proxywatchd.py index 5780f8d..615d614 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -28,6 +28,8 @@ class WorkerJob(): protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto] server_port = 6697 if config.use_ssl else 6667 + fail_inc = 1 + for proto in protos: torhost = random.choice(config.torhosts) duration = time.time() @@ -57,12 +59,16 @@ class WorkerJob(): err == rocksock.RS_E_HIT_TIMEOUT: # proxy is not online, so don't waste time trying all possible protocols break + elif et == rocksock.RS_ET_GAI: + fail_inc = 0 + _log("could not resolve connection target %s"%srv, "ERROR") + break except KeyboardInterrupt as e: raise(e) except: sock.disconnect() - return None, None, None, None, None, 1 + return None, None, None, None, None, fail_inc def run(self): self.nextcheck = (time.time() + 1800 + ((1+int(self.failcount)) * 3600))