Skip to content

Commit 9fd11cf

Browse files
committed
chore: refactor
1 parent 0557743 commit 9fd11cf

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/zeroconf/_core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,14 @@ def __init__(
203203
@property
204204
def started(self) -> bool:
205205
"""Check if the instance has started."""
206+
running_future = self.engine.running_future
206207
return bool(
207208
not self.done
208-
and self.engine.running_future
209-
and self.engine.running_future.done()
210-
and not self.engine.running_future.cancelled()
211-
and not self.engine.running_future.exception()
209+
and running_future
210+
and running_future.done()
211+
and not running_future.cancelled()
212+
and not running_future.exception()
213+
and running_future.result()
212214
)
213215

214216
def start(self) -> None:
@@ -247,6 +249,7 @@ async def async_wait_for_start(self) -> None:
247249
not self.engine.running_future.done()
248250
or self.engine.running_future.cancelled()
249251
or self.engine.running_future.exception()
252+
or not self.engine.running_future.result()
250253
or self.done
251254
):
252255
raise NotRunningException

0 commit comments

Comments
 (0)