Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/zeroconf/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async def async_wait_for_start(self) -> None:
raise NotRunningException

@property
def listeners(self) -> List[RecordUpdateListener]:
def listeners(self) -> Set[RecordUpdateListener]:
return self.record_manager.listeners
Comment thread
bdraco marked this conversation as resolved.

async def async_wait(self, timeout: float) -> None:
Expand Down
7 changes: 6 additions & 1 deletion src/zeroconf/_handlers/record_manager.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ cdef object RecordUpdate
cdef object TYPE_CHECKING
cdef object _TYPE_PTR


cdef class RecordManager:

cdef public object zc
cdef public DNSCache cache
cdef public cython.list listeners
cdef public cython.set listeners

cpdef async_updates(self, object now, object records)

Expand All @@ -29,3 +30,7 @@ cdef class RecordManager:
now_float=cython.float
)
cpdef async_updates_from_response(self, DNSIncoming msg)

cpdef async_add_listener(self, object listener, object question)

cpdef async_remove_listener(self, object listener)
4 changes: 2 additions & 2 deletions src/zeroconf/_handlers/record_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, zeroconf: 'Zeroconf') -> None:
"""Init the record manager."""
self.zc = zeroconf
self.cache = zeroconf.cache
self.listeners: List[RecordUpdateListener] = []
self.listeners: Set[RecordUpdateListener] = set()

def async_updates(self, now: _float, records: List[RecordUpdate]) -> None:
"""Used to notify listeners of new information that has updated
Expand Down Expand Up @@ -175,7 +175,7 @@ def async_add_listener(
" In the future this will fail"
)

self.listeners.append(listener)
self.listeners.add(listener)

if question is None:
return
Expand Down
4 changes: 0 additions & 4 deletions src/zeroconf/_services/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,6 @@ def generate_request_query(
question.unicast = True
return out

def __eq__(self, other: object) -> bool:
"""Tests equality of service name"""
return isinstance(other, ServiceInfo) and other._name == self._name

def __repr__(self) -> str:
"""String representation"""
return '{}({})'.format(
Expand Down