From 9e3c08fcf4a20edc28bcf387fe05bfca4731f879 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 7 Jan 2019 15:57:15 +0000 Subject: [PATCH] watchd: do not count name resolution errors as proxy fail --- proxywatchd.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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))