mirror of
https://github.com/aclist/dztui.git
synced 2026-11-06 10:00:54 +01:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ba6b6c040 | ||
|
|
d3b9ba031d | ||
|
|
8bfcb6c8fe | ||
|
|
353b10ebfc | ||
|
|
698150645d | ||
|
|
87f347870f |
No files matched your search
@@ -125,6 +125,8 @@ 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)
|
||||
@@ -139,15 +141,11 @@ 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()
|
||||
servers.append(res)
|
||||
self.thread_man.set_cleanup_func(
|
||||
StoredFunc(self._cleanup_on_success)
|
||||
)
|
||||
return
|
||||
servers.append(res)
|
||||
break
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
self.thread_man.set_cleanup_func(failure_func, destroy_first=True)
|
||||
|
||||
+4
-6
@@ -2,15 +2,13 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
def read_json(path: Path) -> Any:
|
||||
try:
|
||||
with open(path, "r") as infile:
|
||||
try:
|
||||
data = json.load(infile)
|
||||
return data
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
raise e
|
||||
except OSError as e:
|
||||
data = json.load(infile)
|
||||
return data
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user