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
14 changes: 0 additions & 14 deletions src/zeroconf/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,6 @@ def generate_unregister_all_services(self) -> DNSOutgoing | None:
return out

async def async_unregister_all_services(self) -> None:
"""Unregister all registered services.

Unlike async_register_service and async_unregister_service, this
method does not return a future and is always expected to be
awaited since its only called at shutdown.
"""
# Send Goodbye packets https://datatracker.ietf.org/doc/html/rfc6762#section-10.1
out = self.generate_unregister_all_services()
if not out:
Expand All @@ -618,12 +612,6 @@ async def async_unregister_all_services(self) -> None:
self.async_send(out)

def unregister_all_services(self) -> None:
"""Unregister all registered services.

While it is not expected during normal operation,
this function may raise EventLoopBlocked if the underlying
call to `async_unregister_all_services` cannot be completed.
"""
assert self.loop is not None
run_coro_with_timeout(
self.async_unregister_all_services(),
Expand Down Expand Up @@ -712,7 +700,6 @@ def send(
v6_flow_scope: tuple[()] | tuple[int, int] = (),
transport: _WrappedTransport | None = None,
) -> None:
"""Sends an outgoing packet threadsafe."""
assert self.loop is not None
self.loop.call_soon_threadsafe(self.async_send, out, addr, port, v6_flow_scope, transport)

Expand All @@ -724,7 +711,6 @@ def async_send(
v6_flow_scope: tuple[()] | tuple[int, int] = (),
transport: _WrappedTransport | None = None,
) -> None:
"""Sends an outgoing packet."""
if self.done:
return

Expand Down
10 changes: 0 additions & 10 deletions src/zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def _dns_entry_matches(self, other: DNSEntry) -> bool:
return self.key == other.key and self.type == other.type and self.class_ == other.class_

def __eq__(self, other: Any) -> bool:
"""Equality test on key (lowercase name), type, and class"""
return isinstance(other, DNSEntry) and self._dns_entry_matches(other)

@staticmethod
Expand Down Expand Up @@ -125,7 +124,6 @@ def __hash__(self) -> int:
return self._hash

def __eq__(self, other: Any) -> bool:
"""Tests equality on dns question."""
return isinstance(other, DNSQuestion) and self._dns_entry_matches(other)

@property
Expand Down Expand Up @@ -379,11 +377,9 @@ def write(self, out: DNSOutgoing) -> None:
out.write_name(self.alias)

def __eq__(self, other: Any) -> bool:
"""Tests equality on alias."""
return isinstance(other, DNSPointer) and self._eq(other)

def _eq(self, other: DNSPointer) -> bool:
"""Tests equality on alias."""
return self.alias_key == other.alias_key and self._dns_entry_matches(other)

def __hash__(self) -> int:
Expand Down Expand Up @@ -425,11 +421,9 @@ def __hash__(self) -> int:
return self._hash

def __eq__(self, other: Any) -> bool:
"""Tests equality on text."""
return isinstance(other, DNSText) and self._eq(other)

def _eq(self, other: DNSText) -> bool:
"""Tests equality on text."""
return self.text == other.text and self._dns_entry_matches(other)

def __repr__(self) -> str:
Expand Down Expand Up @@ -508,8 +502,6 @@ def __repr__(self) -> str:


class DNSNsec(DNSRecord):
"""A DNS NSEC record"""

__slots__ = ("_hash", "next_name", "rdtypes")

def __init__(
Expand Down Expand Up @@ -560,11 +552,9 @@ def write(self, out: DNSOutgoing) -> None:
out.write_string(out_bytes)

def __eq__(self, other: Any) -> bool:
"""Tests equality on next_name and rdtypes."""
return isinstance(other, DNSNsec) and self._eq(other)

def _eq(self, other: DNSNsec) -> bool:
"""Tests equality on next_name and rdtypes."""
return (
self.next_name == other.next_name
and self.rdtypes == other.rdtypes
Expand Down
1 change: 0 additions & 1 deletion src/zeroconf/_protocol/incoming.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ def _read_record(
return None

def _read_bitmap(self, end: _int) -> list[int]:
"""Reads an NSEC bitmap from the packet."""
rdtypes = []
if end > self._data_len:
raise IncomingDecodeError(
Expand Down
35 changes: 0 additions & 35 deletions src/zeroconf/_protocol/outgoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,41 +162,6 @@ def add_authorative_answer(self, record: DNSPointer) -> None:
self.authorities.append(record)

def add_additional_answer(self, record: DNSRecord) -> None:
"""Adds an additional answer

From: RFC 6763, DNS-Based Service Discovery, February 2013

12. DNS Additional Record Generation

DNS has an efficiency feature whereby a DNS server may place
additional records in the additional section of the DNS message.
These additional records are records that the client did not
explicitly request, but the server has reasonable grounds to expect
that the client might request them shortly, so including them can
save the client from having to issue additional queries.

This section recommends which additional records SHOULD be generated
to improve network efficiency, for both Unicast and Multicast DNS-SD
responses.

12.1. PTR Records

When including a DNS-SD Service Instance Enumeration or Selective
Instance Enumeration (subtype) PTR record in a response packet, the
server/responder SHOULD include the following additional records:

o The SRV record(s) named in the PTR rdata.
o The TXT record(s) named in the PTR rdata.
o All address records (type "A" and "AAAA") named in the SRV rdata.

12.2. SRV Records

When including an SRV record in a response packet, the
server/responder SHOULD include the following additional records:

o All address records (type "A" and "AAAA") named in the SRV rdata.

"""
self.additionals.append(record)

def _write_byte(self, value: int_) -> None:
Expand Down
2 changes: 0 additions & 2 deletions src/zeroconf/_utils/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def service_type_name(type_: str, *, strict: bool = True) -> str: # pylint: dis
"""
Validate a fully qualified service name, instance or subtype. [rfc6763]

Returns fully qualified service name.

Domain names used by mDNS-SD take the following forms:

<sn> . <_tcp|_udp> . local.
Expand Down
7 changes: 0 additions & 7 deletions src/zeroconf/_utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@


def current_time_millis() -> _float:
"""Current time in milliseconds.

The current implementation uses `time.monotonic`
but may change in the future.

The design requires the time to match asyncio.loop.time()
"""
return time.monotonic() * 1000


Expand Down
6 changes: 0 additions & 6 deletions src/zeroconf/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ async def async_register_service(
)

async def async_unregister_all_services(self) -> None:
"""Unregister all registered services.

Unlike async_register_service and async_unregister_service, this
method does not return a future and is always expected to be
awaited since its only called at shutdown.
"""
await self.zeroconf.async_unregister_all_services()

async def async_unregister_service(self, info: ServiceInfo) -> Awaitable:
Expand Down
Loading