Skip to content

Commit

Permalink
feat: small speed up to fetch dns addresses from ServiceInfo (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed May 25, 2023
1 parent 360ceb2 commit 4deaa6e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/zeroconf/_services/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,15 @@ def dns_addresses(
created: Optional[float] = None,
) -> List[DNSAddress]:
"""Return matching DNSAddress from ServiceInfo."""
name = self.server or self.name
ttl = override_ttl if override_ttl is not None else self.host_ttl
class_ = _CLASS_IN | _CLASS_UNIQUE
return [
DNSAddress(
self.server or self.name,
name,
_TYPE_AAAA if address.version == 6 else _TYPE_A,
_CLASS_IN | _CLASS_UNIQUE,
override_ttl if override_ttl is not None else self.host_ttl,
class_,
ttl,
address.packed,
created=created,
)
Expand Down

0 comments on commit 4deaa6e

Please sign in to comment.