3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

auto-t: change wait_for_object_change behavior

Instead of requiring the initial condition be met when calling
wait_for_object_change, wait for it.

This is how every caller of this function uses it, specifically
with roaming where we first wait for DeviceState.roaming, then
call wait_for_object_change. This can be simplified for the caller
so the initial condition is first waited for.
This commit is contained in:
James Prestwood 2022-09-28 09:36:35 -07:00 committed by Denis Kenzior
parent 9efcea3604
commit 23a22edaed

View File

@ -1160,7 +1160,7 @@ class IWD(AsyncOpAbstract):
def wait_for_object_change(self, obj, from_str, to_str, max_wait = 50): def wait_for_object_change(self, obj, from_str, to_str, max_wait = 50):
''' '''
Expects condition 'from_str' to evaluate true while waiting for 'to_str'. If Wait for 'from_str' to evaluate true then waits for 'to_str'. If
at any point during the wait 'from_str' evaluates false, an exception is at any point during the wait 'from_str' evaluates false, an exception is
raised. raised.
@ -1180,9 +1180,8 @@ class IWD(AsyncOpAbstract):
return False return False
# Does initial condition pass? # wait for initial condition
if not eval(from_str): self._wait_for_object_condition(obj, from_str)
raise Exception("initial condition [%s] not met" % from_str)
ctx.non_block_wait(_eval_from_to, max_wait, obj, from_str, to_str, ctx.non_block_wait(_eval_from_to, max_wait, obj, from_str, to_str,
exception=TimeoutError('[' + to_str + ']'\ exception=TimeoutError('[' + to_str + ']'\