summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scanner.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/scanner.py b/scanner.py
index 0a6fa91..f78e4f6 100644
--- a/scanner.py
+++ b/scanner.py
@@ -38,19 +38,21 @@ class TCPScanner:
t.join()
def run(self):
- try:
- while True:
- if self.failed:
- break
-
- try:
- self._scan(self.q.get(block=False))
- except Exception as e:
- logger.exception(e)
- self.failed = True
- break
- except queue.Empty:
- return
+ while True:
+ if self.failed:
+ break
+
+ try:
+ port = self.q.get(block=False)
+ except queue.Empty:
+ break
+
+ try:
+ self._scan(port)
+ except Exception as e:
+ logger.exception(e)
+ self.failed = True
+ break
def _scan(self, port):
try: