mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 03:06:56 +02:00
fix: break out of loop when scanning LAN
This commit is contained in:
parent
698150645d
commit
8bfcb6c8fe
@ -125,6 +125,8 @@ 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)
|
||||||
@ -139,15 +141,11 @@ 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()
|
||||||
servers.append(res)
|
break
|
||||||
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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user