mirror of
https://github.com/aclist/dztui.git
synced 2026-11-06 01:54:49 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6966db8ae7 |
No files matched your search
@@ -125,8 +125,6 @@ class ServerModelManager:
|
||||
|
||||
@call_on_thread(dialog.scanning)
|
||||
def dump_lan(self, port: int, early_abort: bool) -> None:
|
||||
self.first_iteration = True
|
||||
|
||||
servers = []
|
||||
ports = range(1, 256)
|
||||
failure_func = StoredFunc(self._cleanup_on_failure)
|
||||
@@ -141,11 +139,15 @@ class ServerModelManager:
|
||||
res = future.result(timeout=LAN_TIMEOUT)
|
||||
if res is None:
|
||||
continue
|
||||
servers.append(res)
|
||||
if early_abort is True:
|
||||
# NOTE: on first non-empty hit, flag pending threads to close
|
||||
event.set()
|
||||
break
|
||||
servers.append(res)
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_success)
|
||||
)
|
||||
return
|
||||
servers.append(res)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
|
||||
+6
-4
@@ -2,13 +2,15 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
def read_json(path: Path) -> Any:
|
||||
try:
|
||||
with open(path, "r") as infile:
|
||||
data = json.load(infile)
|
||||
return data
|
||||
except Exception as e:
|
||||
try:
|
||||
data = json.load(infile)
|
||||
return data
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
raise e
|
||||
except OSError as e:
|
||||
raise e
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user