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