From bad4d25bcf512c5ffcace1e07378fd0e1a22016c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Serneels?= Date: Tue, 9 Apr 2019 21:22:52 +0200 Subject: [PATCH] make watchd.tor_safeguard a configurable option (default: True) --- config.py | 1 + proxywatchd.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 2e283e1..baede14 100644 --- a/config.py +++ b/config.py @@ -27,6 +27,7 @@ class Config(ComboParser): self.add_item(section, 'oldies_checktime', int, 43200, 'base checking interval for *old* proxies in seconds (default: 43200)', False) self.add_item(section, 'oldies_multi', int, 100, 'fetch threads*multi rows when testing oldies (default: 100)', False) self.add_item(section, 'source_file', str, 'servers.txt', 'server/url list to read from (default: servers.txt)', False) + self.add_item(section, 'tor_safeguard', bool, True, 'enable tor safeguard (default: True)', False) section = 'ppf' self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False) diff --git a/proxywatchd.py b/proxywatchd.py index 10787a7..e8ebc0c 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -266,7 +266,7 @@ class Proxywatchd(): # check oldies ? if len(rows) < config.watchd.threads and config.watchd.oldies: ## disable tor safeguard for old proxies - self.tor_safeguard = False + if self.tor_safeguard: self.tor_safeguard = False q += ' LIMIT ?' rows = self.mysqlite.execute(q, (config.watchd.max_fail, config.watchd.max_fail*2, config.watchd.checktime, config.watchd.oldies_checktime, time.time(), config.watchd.threads*config.watchd.oldies_multi)).fetchall() return rows @@ -274,7 +274,7 @@ class Proxywatchd(): def prepare_jobs(self): self._prep_db() ## enable tor safeguard by default - self.tor_safeguard = True + self.tor_safeguard = config.watchd.tor_safeguard rows = self.fetch_rows() for row in rows: job = WorkerJob(row[0], row[1], row[2], row[3], row[4])