Compare commits

..
1 Commits
Author SHA1 Message Date
aclist 6966db8ae7 Merge 74bf4b5cfc into d3f64c1ba5 2026-05-19 18:35:54 +09:00
2 changed files with 12 additions and 8 deletions

No files matched your search

+6 -4
View File
@@ -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
View File
@@ -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