diff --git a/build_ext.py b/build_ext.py index 2134f61d4..ba80e52c3 100644 --- a/build_ext.py +++ b/build_ext.py @@ -33,6 +33,7 @@ def build(setup_kwargs: Any) -> None: "src/zeroconf/_handlers/record_manager.py", "src/zeroconf/_handlers/multicast_outgoing_queue.py", "src/zeroconf/_handlers/query_handler.py", + "src/zeroconf/_services/__init__.py", "src/zeroconf/_services/browser.py", "src/zeroconf/_services/info.py", "src/zeroconf/_services/registry.py", diff --git a/src/zeroconf/_services/__init__.pxd b/src/zeroconf/_services/__init__.pxd new file mode 100644 index 000000000..46a75f3c5 --- /dev/null +++ b/src/zeroconf/_services/__init__.pxd @@ -0,0 +1,11 @@ + +import cython + + +cdef class Signal: + + cdef list _handlers + +cdef class SignalRegistrationInterface: + + cdef list _handlers diff --git a/src/zeroconf/_services/browser.pxd b/src/zeroconf/_services/browser.pxd index 8b77c80e3..a844d3330 100644 --- a/src/zeroconf/_services/browser.pxd +++ b/src/zeroconf/_services/browser.pxd @@ -5,6 +5,7 @@ from .._cache cimport DNSCache from .._protocol.outgoing cimport DNSOutgoing, DNSPointer, DNSQuestion, DNSRecord from .._updates cimport RecordUpdateListener from .._utils.time cimport current_time_millis, millis_to_seconds +from . cimport Signal, SignalRegistrationInterface cdef bint TYPE_CHECKING diff --git a/src/zeroconf/_services/browser.py b/src/zeroconf/_services/browser.py index ed4825465..b0b1a0790 100644 --- a/src/zeroconf/_services/browser.py +++ b/src/zeroconf/_services/browser.py @@ -405,7 +405,7 @@ def _enqueue_callback( state_change is SERVICE_STATE_CHANGE_ADDED or ( state_change is SERVICE_STATE_CHANGE_REMOVED - and self._pending_handlers.get(key) != SERVICE_STATE_CHANGE_ADDED + and self._pending_handlers.get(key) is not SERVICE_STATE_CHANGE_ADDED ) or (state_change is SERVICE_STATE_CHANGE_UPDATED and key not in self._pending_handlers) ):