rewrite threading code in jobwatchd

now it distributes the tasks properly among all threads,
and it can be used as a standalone program.
there are some minor performance issues which will be fixed shortly.
This commit is contained in:
rofl0r
2019-01-05 06:35:41 +00:00
parent ff5d121d5f
commit 9ac3ed45d6
3 changed files with 188 additions and 105 deletions

14
ppf.py
View File

@@ -149,7 +149,6 @@ def proxyleech(sqlite, rows):
if __name__ == '__main__':
config.load()
print repr(config.torhosts)
proxies={'http':'socks4://%s' % random.choice(config.torhosts),'https':'socks4://%s' % random.choice(config.torhosts)}
sqlite = mysqlite.mysqlite(config.database, str)
@@ -172,7 +171,11 @@ if __name__ == '__main__':
empty = [ urignore.append(i.split('/')[2]) for i in searx_instances ]
# start proxy watcher
watcherd = proxywatchd.Proxywatchd() if config.watchd_threads > 0 else None
if config.watchd_threads > 0:
watcherd = proxywatchd.Proxywatchd()
watcherd.run_background()
else:
watcherd = None
while True:
try:
@@ -184,9 +187,12 @@ if __name__ == '__main__':
## sleep
else: time.sleep(10)
except KeyboardInterrupt: break
except KeyboardInterrupt:
print "XXXXXX"
if watcherd: watcherd.stop()
break
print '\r',
# stop things
if watcherd: watcherd.stop()
#if watcherd: watcherd.stop()