Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared threadpool #1489

Merged
merged 9 commits into from
Oct 10, 2021
Prev Previous commit
better error handling in scan status checks
  • Loading branch information
TheTechromancer committed Oct 8, 2021
commit bf11b2ee11880ff7df45034af3d528bab0ab1e14
33 changes: 27 additions & 6 deletions sfscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,34 @@ def threadsFinished(self, log_status=False):
if self.eventQueue is None:
return True

modules_waiting = {
m.__name__: m.incomingEventQueue.qsize() for m in
self.__moduleInstances.values() if m.incomingEventQueue is not None
}
modules_waiting = dict()
for m in self.__moduleInstances.values():
try:
if m.incomingEventQueue is not None:
modules_waiting[m.__name__] = m.incomingEventQueue.qsize()
except Exception:
with suppress(Exception):
m.errorState = True
modules_waiting = sorted(modules_waiting.items(), key=lambda x: x[-1], reverse=True)
modules_running = [m.__name__ for m in self.__moduleInstances.values() if m.running]
modules_errored = [m.__name__ for m in self.__moduleInstances.values() if m.errorState]

modules_running = []
for m in self.__moduleInstances.values():
try:
if m.running:
modules_running.append(m.__name__)
except Exception:
with suppress(Exception):
m.errorState = True

modules_errored = []
for m in self.__moduleInstances.values():
try:
if m.errorState:
modules_errored.append(m.__name__)
except Exception:
with suppress(Exception):
m.errorState = True

queues_empty = [qsize == 0 for m, qsize in modules_waiting]

for mod in self.__moduleInstances.values():
Expand Down