diff --git a/zeroconf/_core.py b/zeroconf/_core.py index c9c4c5ec9..f4161877c 100644 --- a/zeroconf/_core.py +++ b/zeroconf/_core.py @@ -400,8 +400,7 @@ def __init__( if ip_version is None: ip_version = autodetect_ip_version(interfaces) - # hook for threads - self._GLOBAL_DONE = False + self.done = False if apple_p2p and sys.platform != 'darwin': raise RuntimeError('Option `apple_p2p` is not supported on non-Apple platforms.') @@ -456,10 +455,6 @@ async def async_wait_for_start(self) -> None: """Wait for start up.""" await self.engine.async_wait_for_start() - @property - def done(self) -> bool: - return self._GLOBAL_DONE - @property def listeners(self) -> List[RecordUpdateListener]: return self.record_manager.listeners @@ -815,7 +810,7 @@ def async_send( transport: Optional[asyncio.DatagramTransport] = None, ) -> None: """Sends an outgoing packet.""" - if self._GLOBAL_DONE: + if self.done: return # If no transport is specified, we send to all the ones @@ -866,10 +861,10 @@ def _async_send_transport( def _close(self) -> None: """Set global done and remove all service listeners.""" - if self._GLOBAL_DONE: + if self.done: return self.remove_all_service_listeners() - self._GLOBAL_DONE = True + self.done = True def _shutdown_threads(self) -> None: """Shutdown any threads."""